mirror of
https://github.com/task-17-lct/backend.git
synced 2024-11-27 23:23:44 +03:00
16 lines
457 B
Python
16 lines
457 B
Python
from celery import shared_task
|
|
|
|
from passfinder.events.models import City
|
|
from passfinder.events.services import get_position_weather
|
|
|
|
api_url = "https://api.weather.yandex.ru/v2/forecast"
|
|
|
|
|
|
@shared_task
|
|
def check_temperature():
|
|
for city in City.objects.all():
|
|
temperature, weather_condition = get_position_weather(city.lat, city.lon)
|
|
city.temperature = temperature
|
|
city.weather_condition = weather_condition
|
|
city.save()
|