Created
September 20, 2023 15:28
-
-
Save discdiver/93999e38db5249d7dc718e90134b18ab to your computer and use it in GitHub Desktop.
Revisions
-
discdiver renamed this gist
Sep 20, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
discdiver created this gist
Sep 20, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import requests from prefect import flow @flow(log_prints=True) def fetch_weather(lat: float = 38.9, lon: float = -77.0): weather = requests.get( "https://api.open-meteo.com/v1/forecast/", params=dict(latitude=lat, longitude=lon, hourly="temperature_2m"), ) most_recent_temp = float(weather.json()["hourly"]["temperature_2m"][0]) print(f"Most recent temp C: {most_recent_temp} degrees") return if __name__ == "__main__": fetch_weather.serve(name="get-weather", cron="0 0 * * *")