mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2025-12-31 19:08:16 -05:00
Compare commits
2 Commits
deployed_0
...
0.34
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da59670d8e | ||
|
|
ed1049b543 |
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="galaxy.plugin.api",
|
||||
version="0.33.1",
|
||||
version="0.34",
|
||||
description="GOG Galaxy Integrations Python API",
|
||||
author='Galaxy team',
|
||||
author_email='galaxy@gog.com',
|
||||
|
||||
@@ -4,6 +4,7 @@ from http import HTTPStatus
|
||||
|
||||
import aiohttp
|
||||
import certifi
|
||||
import logging
|
||||
|
||||
from galaxy.api.errors import (
|
||||
AccessDenied, AuthenticationRequired, BackendTimeout, BackendNotAvailable, BackendError, NetworkError,
|
||||
@@ -21,9 +22,9 @@ class HttpClient:
|
||||
async def close(self):
|
||||
await self._session.close()
|
||||
|
||||
async def request(self, method, *args, **kwargs):
|
||||
async def request(self, method, url, *args, **kwargs):
|
||||
try:
|
||||
response = await self._session.request(method, *args, **kwargs)
|
||||
response = await self._session.request(method, url, *args, **kwargs)
|
||||
except asyncio.TimeoutError:
|
||||
raise BackendTimeout()
|
||||
except aiohttp.ServerDisconnectedError:
|
||||
@@ -33,6 +34,8 @@ class HttpClient:
|
||||
except aiohttp.ContentTypeError:
|
||||
raise UnknownBackendResponse()
|
||||
except aiohttp.ClientError:
|
||||
logging.exception(
|
||||
"Caught exception while running {} request for {}".format(method, url))
|
||||
raise UnknownError()
|
||||
if response.status == HTTPStatus.UNAUTHORIZED:
|
||||
raise AuthenticationRequired()
|
||||
@@ -45,6 +48,8 @@ class HttpClient:
|
||||
if response.status >= 500:
|
||||
raise BackendError()
|
||||
if response.status >= 400:
|
||||
logging.warning(
|
||||
"Got status {} while running {} request for {}".format(response.status, method, url))
|
||||
raise UnknownError()
|
||||
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user