goshippo / shippo-python-client

Shipping API Python library (USPS, FedEx, UPS and more)
https://goshippo.com/docs
MIT License
123 stars 70 forks source link

Getting Not Found error when page=1(some value) is passed to all method. #39

Closed anthonyTE closed 2 years ago

anthonyTE commented 7 years ago

File "/usr/local/lib/python2.7/dist-packages/shippo/resource.py", line 205, in all response, api_key = requestor.request('get', url, params) File "/usr/local/lib/python2.7/dist-packages/shippo/api_requestor.py", line 73, in request resp = self.interpret_response(rbody, rcode) File "/usr/local/lib/python2.7/dist-packages/shippo/api_requestor.py", line 164, in interpret_response rbody, rcode) shippo.error.APIError: Invalid response body from API:

Not Found

The requested URL /v1/carrier_accounts/&page=1 was not found on this server.

(HTTP response code was 404)

The reason is due to the '?' formatting as

'& amp ;'
in the url.

jfriedr commented 2 years ago

@anthonyTE apologies that no one got back to you on this for sometime. Please let me know if the below information doesn't solve your issue:

shippo.config.api_key = "<API-KEY>"
carrier_accounts = shippo.CarrierAccount()
carrier_accounts.all()

***now if you want to get the second page OR just get a specific carrier type.i.e just fedex pass the the following kwargs:

To go to the second page you can use size= and page=:

results = carrier_accounts.all(size=20,page=2)

just get carrier object_ids for 'fedex' carrier or ups:

carrier_accounts.all(carrier="ups")