mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-02 20:08:19 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e09e443064 | ||
|
|
00ed52384a | ||
|
|
958d9bc0e6 | ||
|
|
d73d048ff7 | ||
|
|
e06e40f845 | ||
|
|
833e6999d7 |
@@ -1,8 +1,6 @@
|
|||||||
from galaxy.api.jsonrpc import ApplicationError
|
from galaxy.api.jsonrpc import ApplicationError, UnknownError
|
||||||
|
|
||||||
class UnknownError(ApplicationError):
|
UnknownError = UnknownError
|
||||||
def __init__(self, data=None):
|
|
||||||
super().__init__(0, "Unknown error", data)
|
|
||||||
|
|
||||||
class AuthenticationRequired(ApplicationError):
|
class AuthenticationRequired(ApplicationError):
|
||||||
def __init__(self, data=None):
|
def __init__(self, data=None):
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class MethodNotFound(JsonRpcError):
|
|||||||
|
|
||||||
class InvalidParams(JsonRpcError):
|
class InvalidParams(JsonRpcError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(-32601, "Invalid params")
|
super().__init__(-32602, "Invalid params")
|
||||||
|
|
||||||
class Timeout(JsonRpcError):
|
class Timeout(JsonRpcError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -41,6 +41,10 @@ class ApplicationError(JsonRpcError):
|
|||||||
raise ValueError("The error code in reserved range")
|
raise ValueError("The error code in reserved range")
|
||||||
super().__init__(code, message, data)
|
super().__init__(code, message, data)
|
||||||
|
|
||||||
|
class UnknownError(ApplicationError):
|
||||||
|
def __init__(self, data=None):
|
||||||
|
super().__init__(0, "Unknown error", data)
|
||||||
|
|
||||||
Request = namedtuple("Request", ["method", "params", "id"], defaults=[{}, None])
|
Request = namedtuple("Request", ["method", "params", "id"], defaults=[{}, None])
|
||||||
Method = namedtuple("Method", ["callback", "internal", "sensitive_params"])
|
Method = namedtuple("Method", ["callback", "internal", "sensitive_params"])
|
||||||
|
|
||||||
@@ -171,8 +175,9 @@ class Server():
|
|||||||
self._send_error(request.id, MethodNotFound())
|
self._send_error(request.id, MethodNotFound())
|
||||||
except JsonRpcError as error:
|
except JsonRpcError as error:
|
||||||
self._send_error(request.id, error)
|
self._send_error(request.id, error)
|
||||||
except Exception: #pylint: disable=broad-except
|
except Exception as e: #pylint: disable=broad-except
|
||||||
logging.exception("Unexpected exception raised in plugin handler")
|
logging.exception("Unexpected exception raised in plugin handler")
|
||||||
|
self._send_error(request.id, UnknownError(str(e)))
|
||||||
|
|
||||||
asyncio.create_task(handle())
|
asyncio.create_task(handle())
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ class Plugin():
|
|||||||
async def get_users(self, user_id_list):
|
async def get_users(self, user_id_list):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
async def send_message(self, room_id, message):
|
async def send_message(self, room_id, message_text):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
async def mark_as_read(self, room_id, last_message_id):
|
async def mark_as_read(self, room_id, last_message_id):
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -2,9 +2,9 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="galaxy.plugin.api",
|
name="galaxy.plugin.api",
|
||||||
version="0.16",
|
version="0.18",
|
||||||
description="Galaxy python plugin API",
|
description="Galaxy python plugin API",
|
||||||
author='Galaxy team',
|
author='Galaxy team',
|
||||||
author_email='galaxy@gog.com',
|
author_email='galaxy@gog.com',
|
||||||
packages=find_packages()
|
packages=find_packages(exclude=["tests"])
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user