Skip to content

Commit

Permalink
Resend API url Exposed as a configuration item (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminX authored Dec 4, 2023
1 parent 847e51f commit b26e7c3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions resend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions resend/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b26e7c3

Please sign in to comment.