aboutsummaryrefslogtreecommitdiff
path: root/tor-metrics/relays.py
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2020-02-25 20:53:31 -0700
committerJordan <me@jordan.im>2020-02-25 20:53:31 -0700
commit547c46d9cb8e9d90cbf4504f5e5172eb3f5b96a7 (patch)
treeff875ae5b384cf35b996aa975d8ea174f43ac9de /tor-metrics/relays.py
parenta2f394c4dd1b63acf6fe710d428c1e6a3261c2ff (diff)
downloadallium-547c46d9cb8e9d90cbf4504f5e5172eb3f5b96a7.tar.gz
allium-547c46d9cb8e9d90cbf4504f5e5172eb3f5b96a7.zip
licenses, raise exception rather than returning None (anti-pattern)
Diffstat (limited to 'tor-metrics/relays.py')
-rw-r--r--tor-metrics/relays.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/tor-metrics/relays.py b/tor-metrics/relays.py
index 8b28f56..7693e17 100644
--- a/tor-metrics/relays.py
+++ b/tor-metrics/relays.py
@@ -42,17 +42,7 @@ class Relays:
else:
conn = urllib.request.Request(self.url)
- try:
- api_response = urllib.request.urlopen(conn).read()
- except HTTPError as err:
- print('HTTPError caught during onionoo fetch: %s' % err)
- return None
- except URLError as err:
- print('URLError caught during onionoo fetch: %s' % err)
- return None
- except Exception as err:
- print('Uncaught exception during onionoo fetch: %s' % err)
- return None
+ api_response = urllib.request.urlopen(conn).read()
json_data = json.loads(api_response.decode('utf-8'))
fixed_bw = self.fix_missing_observed_bandwidth(json_data)