- if resp:
- resp = json.loads(resp)
- #print resp
- if not resp or 'id' not in resp:
- raise ClientException("failed to upload package")
- else:
- print resp['id']
+ #print('HTTP CODE: {}'.format(http_code))
+ #print('RESP: {}'.format(resp))
+ 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')
+ # 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 vnfd - {}".format(msg))