mirror of
https://github.com/kennethreitz/neon-api-python.git
synced 2026-06-05 22:50:18 +00:00
Add compact_mapping function and NeonClientException class
This commit is contained in:
+2
-11
@@ -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,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
|
||||
class NeonClientException(HTTPError):
|
||||
pass
|
||||
@@ -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}
|
||||
Reference in New Issue
Block a user