ZeevG/python-forecast.io

502 errors

Closed this issue · 3 comments

dswah commented

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

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.

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

ZeevG commented

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