import shippo
from shippo.models import components, operations
shippo_api_key = '<SHIPPO_API_TOKEN>'
s = shippo.Shippo(api_key_header=shippo_api_key)
carrier_parcel_template = s.carrier_parcel_templates.list(carrier='fedex')
print(service_groups.to_json)
Here's the exception:
AttributeError: 'str' object has no attribute 'items'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jfred/hippo/pip_examples/service_levels.py", line 8, in <module>
carrier_parcel_template = s.carrier_parcel_templates.list(carrier='fedex')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/<>/hippo/pip_examples/sdk_venv/lib/python3.11/site-packages/shippo/carrier_parcel_templates.py", line 75, in list
out = utils.unmarshal_json(http_res.text, Optional[List[components.CarrierParcelTemplate]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/<>/hippo/pip_examples/sdk_venv/lib/python3.11/site-packages/shippo/utils/utils.py", line 827, in unmarshal_json
raise AttributeError(
AttributeError: unable to unmarshal {"results":[{"name":"FedEx® Tube","token":"FedEx_Tube","carrier":"FedEx","is_variable_dimensions":false,"length":"38","width":"6","height":"6","distance_unit":"in"},{"name":"FedEx® Envelope","token":"FedEx_Envelope","carrier":"FedEx","is_variable_dimensions":false,"length":"12.5","width":"9.5","height":"1","distance_unit":"in"},{"name":"FedEx® Large Pak","token":"FedEx_Pak_1","carrier":"FedEx","is_variable_dimensions":false,"length":"15.5","width":"12","height":"1","distance_unit":"in"},{"name":"FedEx® Padded Pak","token":"FedEx_Padded_Pak","carrier":"FedEx","is_variable_dimensions":false,"length":"11.75","width":"14.75","height":"2","distance_unit":"in"},{"name":"FedEx® Extra Large Pak","token":"FedEx_XL_Pak","carrier":"FedEx","is_variable_dimensions":false,"length":"17.5","width":"20.75","height":"2","distance_unit":"in"},{"name":"FedEx® Small Box (S1)","token":"FedEx_Box_Small_1","carrier":"FedEx","is_variable_dimensions":false,"length":"12.375","width":"10.875","height":"1.5","distance_unit":"in"},{"name":"FedEx® Medium Box (M1)","token":"FedEx_Box_Medium_1","carrier":"FedEx","is_variable_dimensions":false,"length":"13.25","width":"11.5","height":"2.375","distance_unit":"in"},{"name":"FedEx® Large Box (L1)","token":"FedEx_Box_Large_1","carrier":"FedEx","is_variable_dimensions":false,"length":"17.5","width":"12.375","height":"3","distance_unit":"in"},{"name":"FedEx® 10kg Box","token":"FedEx_Box_10kg","carrier":"FedEx","is_variable_dimensions":false,"length":"15.81","width":"12.94","height":"10.19","distance_unit":"in"},{"name":"FedEx® 25kg Box","token":"FedEx_Box_25kg","carrier":"FedEx","is_variable_dimensions":false,"length":"54.8","width":"42.1","height":"33.5","distance_unit":"in"},{"name":"FedEx® Large Box (L2)","token":"FedEx_Box_Large_2","carrier":"FedEx","is_variable_dimensions":false,"length":"11.25","width":"8.75","height":"7.75","distance_unit":"in"},{"name":"FedEx® Medium Box (M2)","token":"FedEx_Box_Medium_2","carrier":"FedEx","is_variable_dimensions":false,"length":"11.25","width":"8.75","height":"4.375","distance_unit":"in"},{"name":"FedEx® Small Box (S2)","token":"FedEx_Box_Small_2","carrier":"FedEx","is_variable_dimensions":false,"length":"11.25","width":"8.75","height":"4.375","distance_unit":"in"},{"name":"FedEx® Extra Large Box (X1)","token":"FedEx_Box_Extra_Large_1","carrier":"FedEx","is_variable_dimensions":false,"length":"11.875","width":"11","height":"10.75","distance_unit":"in"},{"name":"FedEx® Extra Large Box (X2)","token":"FedEx_Box_Extra_Large_2","carrier":"FedEx","is_variable_dimensions":false,"length":"15.75","width":"14.125","height":"6","distance_unit":"in"},{"name":"FedEx® Small Pak","token":"FedEx_Pak_2","carrier":"FedEx","is_variable_dimensions":false,"length":"12.75","width":"10.25","height":"1","distance_unit":"in"}]} as typing.Optional[typing.List[shippo.models.components.carrierparceltemplate.CarrierParcelTemplate]] - 'str' object has no attribute 'items'
I'm running the following and seeing an error:
Here's the exception: