GClunies / py_noaa

Python package to fetch data from NOAA Tides & Currents API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connectction times out

slowtoaccept opened this issue · comments

Attempted to connect from simple example:

from pprint import pprint
import noaa_coops as nc
seattle = nc.Station(9447130)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='tidesandcurrents.noaa.gov', port=80): Max retries exceeded with url: /mdapi/v1.0/webapi/stations/9447130.json?expand=details,sensors,products,disclaimers,notices,datums,harcon,tidepredoffets,benchmarks,nearby,bins,deployments,currentpredictionoffsets,floodlevels?units=metric (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000212435D1BB0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))

from pprint import pprint >>> import noaa_coops as nc >>> seattle = nc.Station(9447130)>>> from pprint import pprint >>> import noaa_coops as nc >>> seattle = nc.Station(9447130)

Same error with two other local station ids.

It looks like the mdapi as documented on the noaa site and as used by this project is not currently responding (ex. http://tidesandcurrents.noaa.gov/mdapi/v1.0/webapi/stations/9414290.json). I just emailed them to ask if this is an outage or a permanent change to other apis which do respond such as https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/stations/9414290.json.

changing metadata_base_url to seems to work as is right now and allow requests if they don't respond or if it is a permanent change from their end.
metadata_base_url = ('https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/stations/')