diff --git a/docker-compose.yaml b/docker-compose.yaml index e78a584..29c9f56 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,5 +7,6 @@ services: command: sleep infinity environment: RESEND_API_KEY: ${RESEND_API_KEY} + RESEND_API_URL: ${RESEND_API_URL} # defaults value https://api.resend.com volumes: - .:/app \ No newline at end of file diff --git a/resend/__init__.py b/resend/__init__.py index 111bbbb..5d518e1 100644 --- a/resend/__init__.py +++ b/resend/__init__.py @@ -10,6 +10,7 @@ # Config vars api_key = os.environ.get("RESEND_API_KEY") +api_url = os.environ.get("RESEND_API_URL", "https://api.resend.com") # API resources from .emails import Emails # noqa diff --git a/resend/request.py b/resend/request.py index 7d25a69..809fd18 100644 --- a/resend/request.py +++ b/resend/request.py @@ -9,15 +9,13 @@ # This class wraps the HTTP request creation logic class Request: - base_url: str = "https://api.resend.com" - def __init__(self, path: str, params: Dict, verb: str): self.path = path self.params = params self.verb = verb def perform(self): - resp = self.make_request(url=f"{self.base_url}{self.path}") + resp = self.make_request(url=f"{resend.api_url}{self.path}") # delete calls do not return a body if resp.text == "" and resp.status_code == 200: