diff --git a/neon_client/client.py b/neon_client/client.py index 1edd736..ecead8d 100644 --- a/neon_client/client.py +++ b/neon_client/client.py @@ -5,7 +5,8 @@ import requests from pydantic import BaseModel from . import schema - +from .utils import compact_mapping +from .exceptions import NeonClientException __VERSION__ = "0.1.0" @@ -13,16 +14,6 @@ NEON_API_KEY_ENVIRON = "NEON_API_KEY" NEON_API_BASE_URL = "https://console.neon.tech/api/v2/" -def compact_mapping(obj): - """Compact a mapping by removing None values.""" - - return {k: v for k, v in obj.items() if v is not None} - - -class NeonClientException(requests.exceptions.HTTPError): - pass - - class NeonResource: def __init__( self, diff --git a/neon_client/exceptions.py b/neon_client/exceptions.py new file mode 100644 index 0000000..b3e9226 --- /dev/null +++ b/neon_client/exceptions.py @@ -0,0 +1,5 @@ +from requests.exceptions import HTTPError + + +class NeonClientException(HTTPError): + pass diff --git a/neon_client/utils.py b/neon_client/utils.py new file mode 100644 index 0000000..729978a --- /dev/null +++ b/neon_client/utils.py @@ -0,0 +1,4 @@ +def compact_mapping(obj): + """Compact a mapping by removing None values.""" + + return {k: v for k, v in obj.items() if v is not None}