wpint: make sure actual http response body ends up in backtrace
Right now we just get some cryptic JSON decoding error, rather than any hint of a HTTP status code or the actual error message
This commit is contained in:
parent
ef3dd757be
commit
613b219dcd
|
@ -271,19 +271,24 @@ class WarenpostInt(object):
|
|||
order = self.build_order(items, contact_name=contact_name, order_status=order_status)
|
||||
_logger.info("Order Request: %s", order)
|
||||
r = self.request('POST', 'orders', json = order)
|
||||
if r.ok:
|
||||
# TODO: figure out the AWB and the (item, barcode, voucherId, ...) for the items
|
||||
json_resp = r.json()
|
||||
#print(json.dumps(json_resp, indent=4))
|
||||
_logger.info("Order Response: %s", json_resp)
|
||||
# TODO: download the PDF for each AWB
|
||||
return json_resp
|
||||
else:
|
||||
raise ValueError('%s: %s' % (r.status_code, r.text))
|
||||
|
||||
def api_get_item_label(self, item_id, accept='application/pdf'):
|
||||
"""Download the label for a given item. Returns PDF as 'bytes'"""
|
||||
r = self.request('GET', 'items/%s/label' % item_id, headers={'Accept': accept})
|
||||
r.raise_for_status()
|
||||
return r.content
|
||||
|
||||
def api_get_item_labels(self, awb, accept='application/pdf'):
|
||||
"""Download the labels for all items in a given AWB. Returns PDF as 'bytes'"""
|
||||
r = self.request('GET', 'shipments/%s/itemlabels' % awb, headers={'Accept': accept})
|
||||
r.raise_for_status()
|
||||
return r.content
|
||||
|
|
Loading…
Reference in New Issue