Skip to content

Commit 71ed38e

Browse files
committed
fix status code
1 parent a8d2e5d commit 71ed38e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

mns_subscription/src/mns_service.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,10 @@ def subscribe_notification(self) -> dict | None:
4242
print(f"Headers: {request_headers}")
4343
print(f"Payload: {json.dumps(subscription_payload, indent=2)}")
4444

45-
if response.status_code == 200:
45+
if response.status_code == 201:
4646
return response.json()
4747
elif response.status_code == 404:
4848
return None
4949
else:
50-
try:
51-
api_error = response.json()
52-
except Exception:
53-
api_error = response.text
54-
msg = f"MNS subscription failed with status {response.status_code}: {api_error}"
55-
raise UnhandledResponseError(response=api_error, message=msg)
50+
msg = "Please provide the correct resource type for this endpoint"
51+
raise UnhandledResponseError(response=response.json(), message=msg)

0 commit comments

Comments
 (0)