A Django api to display items and their current up-to-date prices from different online retailers in one platform.

Overview

Price Tracker Backend

A Django api to display items and their current up-to-date prices from different online retailers in one platform. Utilizing scrapy to periodically scrape the latest prices from different online retailers. Store in a PostgreSQL database and make available via an API.

forthebadge made-with-python

Note: This project is a work in progress.

Setup Instructions / Installation

Getting Started

Prerequisites

  • Python and pip (I am currently using 3.9.7) Any version above 3.7 should work.
  • Git installed on your machine
  • Code editor/ IDE
  • PostgreSQL installed on your machine

Installation and Running the App

  1. Clone GitHub repository

    git clone 
  2. Change into the folder

    cd price_tracker_backend
  3. Create a virtual environment

    python3 -m venv venv 
    • Activate the virtual environment
    source ./bin/activate
  • If you are using pyenv:

    3a. Create a virtualenv

    pyenv virtualenv price_tracker_backend

    3b. Activate the virtualenv

    pyenv activate price_tracker_backend
  1. Create a .env file and add your credentials

    touch .env 
    

    OR Copy the included example

    cp .env-example .env 
    
  2. Create a PostgreSQL Database

    psql -U postgres
    
    • Create a database
    CREATE DATABASE price_tracker_db;
    
    • Create a user
    CREATE USER price_tracker_user WITH PASSWORD 'password';
    
    • Grant privileges to the user
    GRANT ALL PRIVILEGES ON DATABASE price_tracker_db TO price_tracker_user;
    
    • Exit the psql session
    \q
    
  3. Add your credentials to the .env file

    5a. export db credentials to your environment variables

    export DATABASE_URL=postgres://user:[email protected]:5432/price_tracker
    
  4. Migrate your database

    python manage.py migrate
  5. Install the required dependencies

    pip install -r requirements.txt
  6. Make the shell script executable

    chmod a+x ./run.sh
  7. Run the app

    ./run.sh

    app should be available on http://127.0.0.1:8081/

    OR run with python

    python manage.py runserver

To run the scrapy spider

 cd price_scraper 
 scrapy crawl jumia_spider

To Run Scrapd and use a web interface

cd price_scraper 
scrapyd

To run ScrapyRT and get a real time API

cd price_scraper 
scrapyrt
  • Test out the api:
 curl "http://localhost:9080/crawl.json?spider_name=jumia_spider&url=https://jumia.co.ke/"

Technologies used

  • Python-3.9.7
  • Django web framework
  • PostgreSQL
  • Scrapy
Owner
Kennedy Ngugi Mwaura
Technical writer --> Python, Django, Flask, Docker,Vue and all things Tech. Backend Developer. Actively looking for remote opportunities
Kennedy Ngugi Mwaura
Dropdown population implementation for Django REST Framework

drf-dropdown Dropdown population implementation for Django REST Framework Usage Add DropdownView to API URL # urls.py import dropdown urlpatterns = [

Preeti Yuankrathok 4 Dec 06, 2022
A Django-powered API with various utility apps / endpoints.

A Django-powered API Includes various utility apps / endpoints. Demos These web apps provide a frontend to the APIs in this project. Issue API Explore

Shemar Lindie 0 Sep 13, 2021
DRF-extensions is a collection of custom extensions for Django REST Framework

Django REST Framework extensions DRF-extensions is a collection of custom extensions for Django REST Framework Full documentation for project is avail

Gennady Chibisov 1.3k Dec 28, 2022
FastAPI framework, high performance, easy to learn, fast to code, ready for production

FastAPI framework, high performance, easy to learn, fast to code, ready for production Documentation: https://fastapi.tiangolo.com Source Code: https:

Sebastián Ramírez 53.1k Jan 06, 2023
Flask RestAPI Project - Transimage Rest API For Python

[ 이미지 변환 플라스크 Rest API ver01 ] 0. Flask Rest API - in SunnyWeb : 이미지 변환 웹의 Flask

OliverKim 1 Jan 12, 2022
Django queries

Djaq Djaq - pronounced “Jack” - provides an instant remote API to your Django models data with a powerful query language. No server-side code beyond t

Paul Wolf 53 Dec 12, 2022
DSpace REST API Client Library

DSpace Python REST Client Library This client library allows Python 3 scripts (Python 2 probably compatible but not officially supported) to interact

The Library Code GmbH 10 Nov 21, 2022
Web APIs for Django. 🎸

Django REST framework Awesome web-browsable Web APIs. Full documentation for the project is available at https://www.django-rest-framework.org/. Fundi

Encode 24.7k Jan 04, 2023
A light REST library for Django.

django-nap Read The Docs: https://django-nap.readthedocs.io/en/latest/ Change log: https://django-nap.readthedocs.io/en/latest/changelog.html An API l

Curtis Maloney 223 Dec 07, 2022
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.

drf-yasg - Yet another Swagger generator Generate real Swagger/OpenAPI 2.0 specifications from a Django Rest Framework API. Compatible with Django Res

Cristi Vîjdea 3k Jan 06, 2023
Simple Crud Api With Django Rest Framework

SIMPLE CRUD API WITH DJANGO REST FRAMEWORK Django REST framework is a powerful and flexible toolkit for building Web APIs. Requirements Python 3.6 Dja

kibet hillary 1 May 03, 2022
Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

Michael 1.1k Dec 28, 2022
One package to access multiple different data sources through their respective API platforms.

BESTLab Platform One package to access multiple different data sources through their respective API platforms. Usage HOBO Platform See hobo_example.py

Wei 1 Nov 16, 2021
A RESTful whois

whois-rest A RESTful whois. Installation $ pip install poetry $ poetry install $ uvicorn app:app INFO: Started server process [64616] INFO: W

Manabu Niseki 4 Feb 19, 2022
A small project in Python + Flask to demonstrate how to create a REST API

SmartBed-RESTApi-Example This application is an example of how to build a REST API. The application os a mock IoT device, simulating a Smart Bed. Impl

Rares Cristea 6 Jan 28, 2022
BloodDonors: Built using Django REST Framework for the API backend and React for the frontend

BloodDonors By Daniel Yuan, Alex Tian, Aaron Pan, Jennifer Yuan As the pandemic raged, one of the side effects was an urgent shortage of blood donatio

Daniel Yuan 1 Oct 24, 2021
Turn your API made with Django REST Framework(DRF) into a GraphQL like API.

Turn your API made with Django REST Framework(DRF) into a GraphQL like API.

Yezy Ilomo 575 Jan 05, 2023
Recursive Serialization for Django REST framework

djangorestframework-recursive Overview Recursive Serialization for Django REST framework This package provides a RecursiveField that enables you to se

336 Dec 28, 2022
A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

Jazzband 3.3k Jan 04, 2023