- # print('HTTP CODE: {}'.format(http_code))
- # print('RESP: {}'.format(resp))
- # if http_code in (200, 201, 202, 204):
- if resp:
- resp = json.loads(resp)
- if not resp or "id" not in resp:
- raise ClientException("unexpected response from server: {}".format(resp))
- print(resp["id"])
- # else:
- # msg = "Error {}".format(http_code)
- # if resp:
- # try:
- # msg = "{} - {}".format(msg, json.loads(resp))
- # except ValueError:
- # msg = "{} - {}".format(msg, resp)
- # raise ClientException("failed to create/update pdu - {}".format(msg))
+ if http_code in (200, 201, 202):
+ if resp:
+ resp = json.loads(resp)
+ if not resp or "id" not in resp:
+ raise ClientException(
+ "unexpected response from server: {}".format(resp)
+ )
+ print(resp["id"])
+ elif http_code == 204:
+ print("Updated")