Skip to content

Commit

Permalink
refactor: simplify header initialization in PreparedRequest and Respo…
Browse files Browse the repository at this point in the history
…nse classes
  • Loading branch information
merrcury committed Jan 30, 2025
1 parent c6e8732 commit 5dd7ef3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/novu_py/_hooks/novuhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class PreparedRequest:
def __init__(self, method: str, url: str, headers: Optional[Dict[str, str]] = None, body: str = ''):
self.method = method
self.url = url
self.headers = {k: v for k, v in (headers or {}).items()}
self.headers = dict((headers or {}).items())
self.body = body

class Response:
def __init__(self, status_code: int = 200, headers: Optional[Dict[str, str]]= None, text: str = '', reason: str = ''):
self.status_code = status_code
self.headers = {k: v for k, v in (headers or {}).items()}
self.headers = dict((headers or {}).items())
self.text = text
self.reason = reason
self.encoding = 'utf-8'
Expand All @@ -41,7 +41,7 @@ def prepare_request(self, method: str, url: str, headers: Optional[Dict[str, str
"""

# Prepare headers
prepared_headers = {k: v for k, v in (headers or {}).items()}
prepared_headers = dict((headers or {}).items())

# Prepare body
body = json.dumps(data) if data and isinstance(data, (dict, list)) else data
Expand Down

0 comments on commit 5dd7ef3

Please sign in to comment.