diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-08 15:27:15 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-27 09:48:36 +0200 |
commit | d74ad9336ecd3dea3728b9cbbc611e1c56404e28 (patch) | |
tree | 1af9d3f65cbf7a37c85c4dec4b2c841e08c78009 /ogcp/og_server.py | |
parent | 3459de36f35839e98e894ae3b58c4f4374d90913 (diff) |
Ignore unreachable ogServers
Otherwise, ogCP crashes trying to connect to unreachable ogServers.
Diffstat (limited to 'ogcp/og_server.py')
-rw-r--r-- | ogcp/og_server.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ogcp/og_server.py b/ogcp/og_server.py index 07dcb2b..0f542ff 100644 --- a/ogcp/og_server.py +++ b/ogcp/og_server.py @@ -23,9 +23,12 @@ class OGServer: self.HEADERS = {'Authorization' : self.api_token} def get(self, path, payload=None): - r = requests.get(f'{self.URL}{path}', - headers=self.HEADERS, - json=payload) + try: + r = requests.get(f'{self.URL}{path}', + headers=self.HEADERS, + json=payload) + except requests.exceptions.ConnectionError: + return None return r def post(self, path, payload): |