Weather API is a Flask-based backend project that provides weather data for any city or postal code. It scrapes weather data from Google's weather page and transforms it into an API. The API supports retrieving weather information in both Celsius and Fahrenheit units.
-
Get weather by city name:
GET http://127.0.0.1:5000/api/weather/<city>
GET http://127.0.0.1:5000/api/weather?city=<city>
-
Get weather by postal code:
GET http://127.0.0.1:5000/api/weather/<postal_code>
GET http://127.0.0.1:5000/api/weather?city=<postal_code>
-
Get weather by city name:
GET http://127.0.0.1:5000/api/weatherf/<city>
GET http://127.0.0.1:5000/api/weatherf?city=<city>
-
Get weather by postal code:
GET http://127.0.0.1:5000/api/weatherf/<postal_code>
GET http://127.0.0.1:5000/api/weatherf?city=<postal_code>
The API returns weather data in the following JSON format:
{
"location": "City, State",
"current": {
"day": "Day, Time",
"summary": "Weather Summary",
"temperature": "Temperature",
"precipitation": "Precipitation",
"humidity": "Humidity",
"wind": "Wind Speed"
},
"weeklyforecast": {
"Day": {
"max": "Maximum Temperature",
"min": "Minimum Temperature"
},
...
}
}
git clone https://github.com/dhimanparas20/Weather-API.git
cd Weather-API
pip3 install requirements.txt
python3 app.py
This API is deployed on Vercel for general use.
This project is open-source and free to use in any project. However, if you use it, please provide proper attribution or mention this project. For any suggested changes or improvements, please feel free to reach out.