Add compact_mapping function and NeonClientException class

This commit is contained in:
2024-01-18 12:31:26 -05:00
parent a0a5645db4
commit 2d47b711cf
3 changed files with 11 additions and 11 deletions
+2 -11
View File
@@ -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,
+5
View File
@@ -0,0 +1,5 @@
from requests.exceptions import HTTPError
class NeonClientException(HTTPError):
pass
+4
View File
@@ -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}