From 19173657fd56ea1071bfbaa9b44902aa9f4b71e5 Mon Sep 17 00:00:00 2001 From: Frank <84723448+svix-frank@users.noreply.github.com> Date: Tue, 29 Jun 2021 10:24:18 -0400 Subject: [PATCH] Python: Cleanup exports, export exceptions as `svix.exceptions` and webhooks as `svix.webhooks` (#82) --- python/svix/__init__.py | 19 ++++++++++++-- python/svix/exceptions.py | 25 +++++++++++++++++++ python/svix/{receiver.py => webhooks.py} | 0 .../{test_receiver.py => test_webhooks.py} | 2 +- 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 python/svix/exceptions.py rename python/svix/{receiver.py => webhooks.py} (100%) rename python/tests/{test_receiver.py => test_webhooks.py} (98%) diff --git a/python/svix/__init__.py b/python/svix/__init__.py index ea2c6bb37..aab1e3e82 100644 --- a/python/svix/__init__.py +++ b/python/svix/__init__.py @@ -1,4 +1,4 @@ -from .api import ( # noqa +from .api import ( ApplicationIn, ApplicationOut, DashboardAccessOut, @@ -10,4 +10,19 @@ Svix, SvixOptions, ) -from .receiver import Webhook, WebhookVerificationError # noqa +from .webhooks import Webhook, WebhookVerificationError + +__all__ = [ + "ApplicationIn", + "ApplicationOut", + "DashboardAccessOut", + "FetchOptions", + "ListResponseApplicationOut", + "ListResponseMessageOut", + "MessageIn", + "MessageOut", + "Svix", + "SvixOptions", + "Webhook", + "WebhookVerificationError", +] diff --git a/python/svix/exceptions.py b/python/svix/exceptions.py new file mode 100644 index 000000000..5aa5c4a39 --- /dev/null +++ b/python/svix/exceptions.py @@ -0,0 +1,25 @@ +from .openapi_client.exceptions import ( + ApiAttributeError, + ApiException, + ApiKeyError, + ApiTypeError, + ApiValueError, + ForbiddenException, + NotFoundException, + ServiceException, + UnauthorizedException, +) +from .webhooks import WebhookVerificationError + +__all__ = [ + "ApiAttributeError", + "ApiException", + "ApiKeyError", + "ApiTypeError", + "ApiValueError", + "ForbiddenException", + "NotFoundException", + "ServiceException", + "UnauthorizedException", + "WebhookVerificationError", +] diff --git a/python/svix/receiver.py b/python/svix/webhooks.py similarity index 100% rename from python/svix/receiver.py rename to python/svix/webhooks.py diff --git a/python/tests/test_receiver.py b/python/tests/test_webhooks.py similarity index 98% rename from python/tests/test_receiver.py rename to python/tests/test_webhooks.py index 2e605d71d..3674856f4 100644 --- a/python/tests/test_receiver.py +++ b/python/tests/test_webhooks.py @@ -5,7 +5,7 @@ from math import floor from datetime import datetime, timedelta, timezone -from svix.receiver import hmac_data, Webhook, WebhookVerificationError +from svix.webhooks import hmac_data, Webhook, WebhookVerificationError defaultMsgID = 'msg_p5jXN8AQM9LWM0D4loKWxJek' defaultPayload = '{"test": 2432232314}'