Skip to content

01behnaz/weather_api_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Waether api

Request the weather data of cities from https://openweathermap.org/

Description

Using lat and lon of each city and timezonefinder, we get the time zone:

from timezonefinder import TimezoneFinder

tf = TimezoneFinder()  

query_points = [(51.4215, 35.6944), ...]
for lng, lat in query_points:
    tz = tf.timezone_at(lng=lng, lat=lat)  # 'Asia/Tehran'

Using timezone and datetime, we get the time and date:

from datetime import datetime
import pytz

datetime_in_Tehran = datetime.now(pytz.timezone('Asia/Tehran'))

print(datetime_in_Tehran)
# 2023-03-12 15:35:18.904024+03:30

Requirements

  • python 3.9
  • pyqt5
  • datetime
  • timezonefinder
  • pytz

Usage

First, install the required packages and create an account on the https://openweathermap.org/ and get an API key and write it in the url, and now is ready to run...

My Image

About

Get weather data for cities using python and pyqt5

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages