Skip to content

Commit

Permalink
fix: POST requests use data
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-zippenfenig committed Jul 22, 2024
1 parent 78e25ff commit 103c53c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openmeteo_requests/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def __init__(self, session: TSession | None = None):
def _get(self, cls: type[T], url: str, params: any, method: str) -> list[T]:
params["format"] = "flatbuffers"

response = self.session.request(method, url, params=params)
if method.upper() == "POST":
response = self.session.request("POST", url, data=params)
else:
response = self.session.request("GET", url, params=params)

if response.status_code in [400, 429]:
response_body = response.json()
raise OpenMeteoRequestsError(response_body)
Expand Down

0 comments on commit 103c53c

Please sign in to comment.