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

API key not properly passed via shippo client #55

Closed vsoch closed 4 years ago

vsoch commented 5 years ago

Shippo version: shippo==2.0.0rc1

I'm using a test token to generate and validate an address, and when I provide the key to shippo directly it doesn't work:

import shippo
shippo.api_key = SHIPPO_TOKEN

# create address here

AuthenticationError: No API key provided. (HINT: set your API key using "shippo.api_key = shippo_test_d90f00698a0a8def0495fddb4212bb08051469d3"). You can generate API keys from the Shippo web interface.  See https://goshippo.com/api for details, or email support@goshippo.comom if you have any questions.

However when I provide "api_key" directly to the function it works. This seems like a bug, as the documentation details being able to provide it to shippo directly.

hwangm commented 4 years ago

@vsoch the top level config variables including api_key have been moved to the shippo.config namespace. Have you tried setting shippo.config.api_key = SHIPPO_TOKEN instead?

vsoch commented 4 years ago

I haven’t, but we are fine with providing the key to each function as needed. I do remember following the tutorial and providing it directly to the client but that didn’t seem to work. It must have been that previously the key was added directly to the client and now it’s added to the client config? Either way I’m happy to close the issue as we have a working solution.

hwangm commented 4 years ago

One of the changes in 2.0.0rc1 was moving the api_key assignment to shippo.config instead of shippo, looks like we missed updating the error message you saw above. Updating the API guide and reference to reflect this change will be updated with the 2.0.0 release. Thanks!