Skip to content

Commit

Permalink
switch requests param to json, as Content-Type-Header is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Aug 12, 2024
1 parent 5bd87d3 commit ae617dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/edutap/wallet_google/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def create(
resource_id, verified_json = _validate_data_and_convert_to_json(model, data)
session = session_manager.session
url = session_manager.url(name)
response = session.post(url=url, data=verified_json.encode("utf-8"))
response = session.post(url=url, json=verified_json.encode("utf-8"))
if response.status_code == 409:
raise Exception(
f"Wallet Object {name} {getattr(data, 'id', 'No ID')} already exists\n{response.text}"
Expand Down Expand Up @@ -177,12 +177,12 @@ def update(
if partial:
response = session.patch(
url=session_manager.url(name, f"/{resource_id}"),
data=verified_json.encode("utf-8"),
json=verified_json.encode("utf-8"),
)
else:
response = session.put(
url=session_manager.url(name, f"/{resource_id}"),
data=verified_json.encode("utf-8"),
json=verified_json.encode("utf-8"),
)
logger.debug(verified_json.encode("utf-8"))
if response.status_code == 404:
Expand Down Expand Up @@ -251,7 +251,7 @@ def message(
)
session = session_manager.session
url = session_manager.url(name, f"/{resource_id}/addMessage")
response = session.post(url=url, data=verified_json.encode("utf-8"))
response = session.post(url=url, json=verified_json.encode("utf-8"))

if response.status_code == 404:
raise LookupError(f"Error 404, {name} not found: - {response.text}")
Expand Down

0 comments on commit ae617dd

Please sign in to comment.