From f6167c2e17452690aa8c6dfe5b4c67fbfb74e33a Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 10 Jun 2016 16:26:09 +0300 Subject: api.ConnectionError -> api.APIConnectionError To avoid clashes with the standard library. --- api.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'api.py') diff --git a/api.py b/api.py index 40df08a..0f1333d 100644 --- a/api.py +++ b/api.py @@ -75,18 +75,17 @@ class User: def __str__(self): return self.value - -class Error(RuntimeError): +class APIError(RuntimeError): pass -class InvalidResponseError(Error): +class InvalidAPIResponseError(APIError): def __init__(self, response): self.response = response def __str__(self): return str(self.response) -class ConnectionError(Error): +class APIConnectionError(APIError): pass class API: @@ -114,10 +113,10 @@ class API: with urllib.request.urlopen(url) as request: response = json.loads(request.read().decode()) if 'response' not in response: - raise InvalidResponseError(response) + raise InvalidAPIResponseError(response) return response['response'] except URLError: - raise ConnectionError() + raise APIConnectionError() @staticmethod def _format_param_values(xs): -- cgit v1.2.3