Giter Club home page Giter Club logo

skryptowe20's Introduction

REST with Django Rest Framework


This API offers simple GET request, fetching currency values to Polish Zloty. It also allows to get sale statistics based date parameter. GET requests return in form of JSON.

  1. Install Guide
  2. Adding new currency
  3. API usage
  4. Limits
  5. Dependencies
  6. Credits

Install Guide

This projects implements automatic database creation for currency values. It also provides sample database file sales.db for sales statistic API demonstration.

  1. Clone this repo:
    git clone https://github.com/Rochala/skryptowe20.git
  2. ** Checkout to REST branch **
    git checkout REST
  3. Install requirement
    pip install -r requirements.txt
  4. Run initializing script
    python3 init.py
  5. [OPTIONAL] Make sure models.py SalesStats contains every currency
  6. ** Configure Django project to your needs **
  7. Start django
    python3 manage.py runserver

Adding new currency

  1. Make sure NBP api supports it
  2. Add new currency symbol to constants.py Currency enum
  3. Run init.py script
    python3 init.py
  4. Add new variable in models.py to SalesStats class following way:
    {CURRENCY_SYMBOL_LOWERCASED} = models.FloatField()

API usage

Currency data range http://127.0.0.1:8000/CurrencyRange/?symbol={CURRENCY SYMBOL}start={DATE START}&end={DATE END} Example usage for USD between 2020-12-01 and 2020-12-16 http://127.0.0.1:8000/CurrencyRange/?symbol=USD&start=2020-12-01&end=2020-12-16

Sales statistics http://127.0.0.1:8000/SaleStats/?date={SELECTED DATE} Example usage for fetching sales from 2005-05-17 http://127.0.0.1:8000/SaleStats/?date=2005-05-17 You can also get whole range by using http://127.0.0.1:8000/SaleStats/


Limits

User type Limit
Anonymous user: 10 / hour
Standard User : 1000 / hour

Currency API is also limited by dates 2001-01-02 and 2020-12-17
Avaliable currencies are: 'USD', 'EUR', 'CHF'


Dependencies


Credits

  • NBP for sharing currency API
  • Kaggle for sharing database sample data

skryptowe20's People

Contributors

realgs avatar rochala avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.