diff options
author | Jordan <me@jordan.im> | 2020-02-25 20:53:31 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2020-02-25 20:53:31 -0700 |
commit | 547c46d9cb8e9d90cbf4504f5e5172eb3f5b96a7 (patch) | |
tree | ff875ae5b384cf35b996aa975d8ea174f43ac9de /tor-metrics/relays.py | |
parent | a2f394c4dd1b63acf6fe710d428c1e6a3261c2ff (diff) | |
download | allium-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.py | 12 |
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) |