-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weather #10
Conversation
Develop -> master
…n API variable added to config.py, same in .env.example
requests as httpx |
added new variables for weather tokens
added new attributes for weather tokens
added new weather URLs; request changed to httpx; try-except block changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip install black
black .
bot/services/weather.py
Outdated
sunrise_timestamp = datetime.datetime.fromtimestamp(data["sys"]["sunrise"]) | ||
sunrise_out = sunrise_timestamp.strftime("%H:%M:%S") | ||
sunset_timestamp = datetime.datetime.fromtimestamp(data["sys"]["sunset"]) | ||
sunset_out = sunset_timestamp.strftime("%H:%M:%S") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serialiser(a or b or c):
...
bot/services/weather.py
Outdated
('OpenMeteo', 'https://api.open-meteo.com/v1/forecast', | ||
{'latitude': latitude, 'longitude': longitude, 'current_weather': 'true'}) | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coro_list = []
for name, url, params in URLS:
async with httpx.AsyncClient() as client:
coro_list.append(client.get(url, params=params))
responses = await asyncio.gather(**coro_list)
data_res = [i.json() for i in responses if i.status_code==200]
test |
…weather have been added
Added files bot/handlers/weather.py and bot/services/weather.py.
Weather token API variable added to config.py, same in .env.example