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
A minimalistic manga reader for desktop built with React and Django

smanga A minimalistic manga reader/server for serving local manga images on desktop browser. Provides a two-page view layout just as reading a physica

Padam Upreti 13 Sep 24, 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
A lightweight REST miniframework for Python.

restless A lightweight REST miniframework for Python. Documentation is at https://restless.readthedocs.io/. Works great with Django, Flask, Pyramid, T

Daniel Lindsley 824 Nov 20, 2022
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 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
Document Web APIs made with Django Rest Framework

DRF Docs Document Web APIs made with Django Rest Framework. View Demo Contributors Wanted: Do you like this project? Using it? Let's make it better! S

Manos Konstantinidis 626 Nov 20, 2022
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
Creating delicious APIs for Django apps since 2010.

django-tastypie Creating delicious APIs for Django apps since 2010. Currently in beta but being used actively in production on several sites. Requirem

3.8k Dec 30, 2022
REST API with Flask. No data persistence.

Flask REST API Python 3.9.7 The Flask experience, without data persistence :D First, to install all dependencies: python -m pip install -r requirement

Luis Quiñones Requelme 1 Dec 15, 2021
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
JSON:API support for Django REST framework

JSON:API and Django REST framework Overview JSON:API support for Django REST framework Documentation: https://django-rest-framework-json-api.readthedo

1k Dec 27, 2022
Simplified REST API to get stickers from Snap

Snap Sticker kit REST API Simplified REST API to get stickers from Snap 💻 Instructions Search stickers Request: url = "https://sticker-kit-horizon733

Dishant Gandhi 1 Jan 05, 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
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
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 525 Jan 01, 2023
Mlflow-rest-client - Python client for MLflow REST API

Python Client for MLflow Python client for MLflow REST API. Features: Minimal de

MTS 35 Dec 23, 2022
Country-specific Django helpers, to use in Django Rest Framework

django-rest-localflavor Country-specific serializers fields, to Django Rest Framework Documentation (soon) The full documentation is at https://django

Gilson Filho 19 Aug 30, 2022
Swagger Documentation Generator for Django REST Framework: deprecated

Django REST Swagger: deprecated (2019-06-04) This project is no longer being maintained. Please consider drf-yasg as an alternative/successor. I haven

Marc Gibbons 2.6k Dec 23, 2022
Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.

Read Latest Documentation - Browse GitHub Code Repository hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a r

Hug API Framework 6.7k Dec 27, 2022
Key-Value база данных на Tarantool и REST API к ней.

KVmail Key-Value база данных на Tarantool и REST API к ней. Документация к API доступна здесь. Requiremrnts ubuntu 16.04+ python3.6+ supervisord nginx

1 Jun 16, 2021