Loading erddapy when being offline raise an error (see below) because it can init the servers list.
A direct use of erddapy when being offline may not be relevant, but in the case where erddapy is part of a larger package that does not entirely rely on online activities, should we expect loading erddapy to fail silently ?
gaierror Traceback (most recent call last)
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1317 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318 encode_chunked=req.has_header('Transfer-encoding'))
1319 except OSError as err: # timeout error
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in request(self, method, url, body, headers, encode_chunked)
1261 """Send a complete request to the server."""
-> 1262 self._send_request(method, url, body, headers, encode_chunked)
1263
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1307 body = _encode(body, 'body')
-> 1308 self.endheaders(body, encode_chunked=encode_chunked)
1309
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in endheaders(self, message_body, encode_chunked)
1256 raise CannotSendHeader()
-> 1257 self._send_output(message_body, encode_chunked=encode_chunked)
1258
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in _send_output(self, message_body, encode_chunked)
1035 del self._buffer[:]
-> 1036 self.send(msg)
1037
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in send(self, data)
973 if self.auto_open:
--> 974 self.connect()
975 else:
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in connect(self)
1414
-> 1415 super().connect()
1416
~/anaconda/envs/obidam36/lib/python3.6/http/client.py in connect(self)
945 self.sock = self._create_connection(
--> 946 (self.host,self.port), self.timeout, self.source_address)
947 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
~/anaconda/envs/obidam36/lib/python3.6/socket.py in create_connection(address, timeout, source_address)
703 err = None
--> 704 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
705 af, socktype, proto, canonname, sa = res
~/anaconda/envs/obidam36/lib/python3.6/socket.py in getaddrinfo(host, port, family, type, proto, flags)
744 addrlist = []
--> 745 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
746 af, socktype, proto, canonname, sa = res
gaierror: [Errno 8] nodename nor servname provided, or not known
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
in
1 # from argopy.data_fetchers import erddap_data as Erddap_Fetchers
----> 2 import erddapy
~/anaconda/envs/obidam36/lib/python3.6/site-packages/erddapy/init.py in
3 """
4
----> 5 from erddapy.erddapy import ERDDAP, servers
6
7
~/anaconda/envs/obidam36/lib/python3.6/site-packages/erddapy/erddapy.py in
12 import pandas as pd
13
---> 14 from erddapy.utilities import (
15 _nc_dataset,
16 _tempnc,
~/anaconda/envs/obidam36/lib/python3.6/site-packages/erddapy/utilities.py in
51
52
---> 53 servers = servers_list()
54
55
~/anaconda/envs/obidam36/lib/python3.6/site-packages/erddapy/utilities.py in servers_list()
42 def servers_list():
43 url = "https://raw.githubusercontent.com/IrishMarineInstitute/awesome-erddap/master/erddaps.json"
---> 44 df = pd.read_json(url)
45 _server = namedtuple("server", ["description", "url"])
46 return {
~/anaconda/envs/obidam36/lib/python3.6/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
197 else:
198 kwargs[new_arg_name] = new_arg_value
--> 199 return func(*args, **kwargs)
200
201 return cast(F, wrapper)
~/anaconda/envs/obidam36/lib/python3.6/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
294 )
295 warnings.warn(msg, FutureWarning, stacklevel=stacklevel)
--> 296 return func(*args, **kwargs)
297
298 return wrapper
~/anaconda/envs/obidam36/lib/python3.6/site-packages/pandas/io/json/_json.py in read_json(path_or_buf, orient, typ, dtype, convert_axes, convert_dates, keep_default_dates, numpy, precise_float, date_unit, encoding, lines, chunksize, compression, nrows)
592 compression = infer_compression(path_or_buf, compression)
593 filepath_or_buffer, _, compression, should_close = get_filepath_or_buffer(
--> 594 path_or_buf, encoding=encoding, compression=compression
595 )
596
~/anaconda/envs/obidam36/lib/python3.6/site-packages/pandas/io/common.py in get_filepath_or_buffer(filepath_or_buffer, encoding, compression, mode, storage_options)
181 if isinstance(filepath_or_buffer, str) and is_url(filepath_or_buffer):
182 # TODO: fsspec can also handle HTTP via requests, but leaving this unchanged
--> 183 req = urlopen(filepath_or_buffer)
184 content_encoding = req.headers.get("Content-Encoding", None)
185 if content_encoding == "gzip":
~/anaconda/envs/obidam36/lib/python3.6/site-packages/pandas/io/common.py in urlopen(*args, **kwargs)
135 import urllib.request
136
--> 137 return urllib.request.urlopen(*args, **kwargs)
138
139
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
221 else:
222 opener = _opener
--> 223 return opener.open(url, data, timeout)
224
225 def install_opener(opener):
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout)
524 req = meth(req)
525
--> 526 response = self._open(req, data)
527
528 # post-process response
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in _open(self, req, data)
542 protocol = req.type
543 result = self._call_chain(self.handle_open, protocol, protocol +
--> 544 '_open', req)
545 if result:
546 return result
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
502 for handler in handlers:
503 func = getattr(handler, meth_name)
--> 504 result = func(*args)
505 if result is not None:
506 return result
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in https_open(self, req)
1359 def https_open(self, req):
1360 return self.do_open(http.client.HTTPSConnection, req,
-> 1361 context=self._context, check_hostname=self.check_hostname)
1362
1363 https_request = AbstractHTTPHandler.do_request
~/anaconda/envs/obidam36/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1318 encode_chunked=req.has_header('Transfer-encoding'))
1319 except OSError as err: # timeout error
-> 1320 raise URLError(err)
1321 r = h.getresponse()
1322 except:
URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>