ZeevG / python-forecast.io

A thin Python Wrapper for the Dark Sky (formerly forecast.io) weather API
http://zeevgilovitz.com/python-forecast.io/
Other
424 stars 88 forks source link

502 errors #55

Closed dswah closed 6 years ago

dswah commented 6 years ago

thank you very much for your wrapper. i've built production tools that use it multiple times daily.

ive noticed that im receiving multiple 502 errors for multiple lat-longs, and various times of the day.

502 Server Error: Bad Gateway for url: https://api.darksky.net/forecast/{token}/37.2972061,-121.9574981,2018-01-20T20:35:13+00:00?units=auto

have you seen these errors before? do you know what could be causing them?

thanks, dani

BrianMitchL commented 6 years ago

I believe these are purely server errors on Dark Sky's side. I handle this with a try/except block like the following:

try:
  return forecastio.manual('https://api.darksky.net/forecast/{token}/37.2972061,-121.9574981')
except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError) as err:
  print(err)
  return None

Note: I wrote this code a while ago, so these exceptions may not be a complete list of raisable network exceptions.

BrianMitchL commented 6 years ago

Also, it looks like Dark Sky was having degraded performance recently: http://status.darksky.net/2018/01/18/degraded-service.html

ZeevG commented 6 years ago

I'm closing this as it no longer seems to be a problem.