Skip to content

amiradmin/openweatherAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenWeather API

This project is about an api which receives a request width a slug as city name and sends a
request for OpenWeatherMap web service , after getting back the result it saves its into database.

The project has decided into three parts

  • openweatherapi which sends request to the OpenWeatherMap
  • wather Django app which parse re sponses and savethem in the database.
  • Test section which does unittest different parts of project.

Installation:

  1. If you os is Ubuntu there is a virtualenv ready which you can activate it by following command:

source venv/bin/activate

otherwise it's better to create your own virtualenv 2. Setup project with bellow command:

python3 setup.py install

  1. got to the root project directory

cd mysite

  1. Run Django

python manage.py runserver

How to use:

1.You can send request to the following list :
http://localhost:8000/weather/{cityName}
Example:
http://localhost:8000/weather/berlin

Test:

For test i decided to use pytest.For unittest use following commands to run different tests.
Please got to mysite/tests folder 1.Testing OpenWaather webservice connection:

python -m pytest openapi_test.py

2.Testing wather Django api :

python -m pytest weather_api_test.py

3.Testing data entry to database:

python3 -m pytest database_test.py

Credencials:


For Login to Django Admin Panel http://localhost/admin
Username: "Amir"
Password: "Eddy@747" (Eddy is my lovely dog)

Used technologies:

  • Django(a high-level Python web framework that encourages rapid development and clean, pragmatic design.)
  • Python Programming Language
  • Django Rest Framework for designing a restful application
  • Numpy library to create a uniform array for get temperature

Next Stage

Dockerized the project and create two containers for database and rest of project and also I like to use my favourite database Postgres instead of sqlite.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages