Compare commits

..

4 Commits
0.33 ... 0.34

Author SHA1 Message Date
Rafal Makagon
da59670d8e Increment version 2019-06-14 16:35:20 +02:00
Rafal Makagon
ed1049b543 Write down unexpected responses from http client 2019-06-14 16:32:07 +02:00
Rafal Makagon
9e8748b032 Increment version 2019-06-14 14:41:34 +02:00
Mieszko Banczerowski
bb482d4ed6 SDK-2872 update documentation about plugin deployment 2019-06-14 11:51:30 +02:00
3 changed files with 48 additions and 5 deletions

View File

@@ -55,8 +55,20 @@ if __name__ == "__main__":
## Deployment
The client has a built-in Python 3.7 interpreter, so the integrations are delivered as `.py` files.
The additional `manifest.json` file is required:
The client has a built-in Python 3.7 interpreter, so the integrations are delivered as python modules.
In order to be found by GOG Galaxy 2.0 an integration folder should be placed in [lookup directory](#deploy-location). Beside all the python files, the integration folder has to contain [manifest.json](#deploy-manifest) and all third-party dependencies. See an [examplary structure](#deploy-structure-example).
### <a name="deploy-location"></a> Lookup directory:
- Windows:
`%localappdata%\GOG.com\Galaxy\plugins\installed`
- macOS:
`~/Library/Application Support/GOG.com/Galaxy/plugins/installed`
### <a name="deploy-manifest"></a> Manifest
Obligatory JSON file to be placed in a integration folder.
```json
{
@@ -71,6 +83,32 @@ The additional `manifest.json` file is required:
"script": "plugin.py"
}
```
| property | description |
|---------------|---|
| `guid` | |
| `description` | |
| `url` | |
| `script` | path of the entry point module, relative to the integration folder |
### Dependencies
All third-party packages (packages not included in Python 3.7 standard library) should be deployed along with plugin files. Use the folowing command structure:
```pip install DEP --target DIR --implementation cp --python-version 37```
For example plugin that uses *requests* has structure as follows:
<a name="deploy-structure-example"></a>
```bash
installed
└── my_integration
   ├── galaxy
   │   └── api
   ├── requests
   │   └── ...
   ├── plugin.py
└── manifest.json
```
## Legal Notice
By integrating or attempting to integrate any applications or content with or into GOG Galaxy 2.0 you represent that such application or content is your original creation (other than any software made available by GOG) and/or that you have all necessary rights to grant such applicable rights to the relevant community integration to GOG and to GOG Galaxy 2.0 end users for the purpose of use of such community integration and that such community integration comply with any third party license and other requirements including compliance with applicable laws.

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="galaxy.plugin.api",
version="0.33",
version="0.34",
description="GOG Galaxy Integrations Python API",
author='Galaxy team',
author_email='galaxy@gog.com',

View File

@@ -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