diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-10 16:26:09 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-10 16:26:09 +0300 |
commit | f6167c2e17452690aa8c6dfe5b4c67fbfb74e33a (patch) | |
tree | 2fd8d9e05d6941a35a40816b297eb2ed8e0960be /api.py | |
parent | refactoring (diff) | |
download | vk-scripts-f6167c2e17452690aa8c6dfe5b4c67fbfb74e33a.tar.gz vk-scripts-f6167c2e17452690aa8c6dfe5b4c67fbfb74e33a.zip |
api.ConnectionError -> api.APIConnectionError
To avoid clashes with the standard library.
Diffstat (limited to '')
-rw-r--r-- | api.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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): |