Skip to content

This is a REST API developed using Python Django Rest Framework to fetch meta data by scraping data based on the metar code provided from the UI. Using redis to store cache for fast loading and fetching data for same code from cache instead of scraping again.

Notifications You must be signed in to change notification settings

vivaan998/Django-Metar

Repository files navigation

Django Project to get Meta data about Metar codes and display information.

Requirements

This Project is developed using Django and Redis . Additional requirements are included in requirement.txt file for interaction with https://tgftp.nws.noaa.gov/data/observations/metar/stations/ website.

Also change the Redis_HOST and Redis_PORT in the settings.py if deploying on any other server.
The Project uses Redis, Web Drivers, Selenium and such libraries to develop the application.

This application is developed and tested well in Windows Environment. While instaling or running the app locally, if there occurs any error because of versioning, feel free to ping me on vivannathani99@gmail.com

How to run project locally

Clone repository and got to project's root directory afterwards follow steps:

  1. Activate python virtual environment
    source /path/to/local/env

  2. Install requirements
    pip install -r requirements.txt

  3. Run Redis server
    Dowload it from the https://redis.io/ based on your system requirements
    Refer to https://redis.io/topics/quickstart for installation guide.

Once the redis file has be installed extract it and open the terminal and run the following command to run server redis-server

To check if it responds to client open a new terminal and run redis client ping this command returns "Pong".

Congratulations! Your redis server has been served

  1. Now, Run server
    python manage.py runserver

Results

GET /

Has the frontend of the search. The button in the header part checks Status of Redis Server.

GET /metar/ping

This checks if the Redis server is live or not,If not, it returns Connection refused else returns

{
    "data": "Pong"
}

GET /metar/info?scode=

Fetches metar code from the url and checks if the metar code exists, if not it returns "Metar Code Dosen't Exsits"

On re-visiting the same code again, the data is fetched from the Redis-cache for lower latency and faster loading process.


Currently the Cache Time to Leave for the code/view to be deleted is set to be 5 minutes, mentioned in settings.py file.

For Instance look at the images below for better Visualization and Understanding

Alt-Text


Alt-Text

About

This is a REST API developed using Python Django Rest Framework to fetch meta data by scraping data based on the metar code provided from the UI. Using redis to store cache for fast loading and fetching data for same code from cache instead of scraping again.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published