Skip to content

Instantly share code, notes, and snippets.

@moustachio-belvedere
Created July 16, 2019 00:36
Show Gist options
  • Save moustachio-belvedere/066791bcff13c24da7d9456d55586acf to your computer and use it in GitHub Desktop.
Save moustachio-belvedere/066791bcff13c24da7d9456d55586acf to your computer and use it in GitHub Desktop.
import datapoint as met
# api key
apikey = "Insert your api key here!"
# set lattitude and longitude of Cambridge UK
latitude, longitude = 52.2053, 0.1218
# initialise connection and get forecast with hour time-steps
conn = met.connection(api_key = apikey)
site = conn.get_nearest_forecast_site(latitude, longitude)
forecast = conn.get_forecast_for_site(site.id, "3hourly")
weathernow = forecast.now()
print("Temperature at {} is currently {} degrees celsius.".format(site.name, weathernow.temperature.value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment