8000 GitHub - jonnie/product-api-old: Product API based on different data sources
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jonnie/product-api-old

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product API

Setting up the environment

This guide assumes that Python 3 is already installed. To setup this project follow these instructions:

python3 -m venv env
. env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Note: if you get an error stating python3 cannot be found simply replace this with python

Running the API app

This project uses gunicorn to launch the api, to run this command:

gunicorn -b 127.0.0.1:8000 app.api:app

Hold down Ctrl+C to stop the server

Access the API app

Use a tool like Postman to execute the following as examples:

List of products (limited to 50 by default): http://127.0.0.1:8000/product List of products with specified limit: http://127.0.0.1:8000/product/?limit=100 Retrieve a single product by id: http://127.0.0.1:8000/product/8182756

Configuration

Located at app/config.py is a class containing a series of configuration variables used by the app:

EXCLUDE_FREE_PRODUCTS = True
PRODUCTS_CSV_FILEPATH = 'data/products.csv.gz'
PRODUCTS_JSON_URL     = 'https://s3-eu-west-1.amazonaws.com/pricesearcher-code-tests/python-software-developer/products.json'
DEFAULT_PRODUCT_LIMIT = 50

These are the defaults and can be changed, however the server will need to be restarted for the changes to take effect.

About

Product API based on different data sources

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0