Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apikey-attribute in SendGridAPIClient.__init__() rendered useless by commit 1ee10fda132e132ca99ddcc7ff7149cebc4d96a2 #197

Closed
johguse opened this issue Jul 26, 2016 · 2 comments
Labels
status: help wanted requesting help from the community type: bug bug in the library

Comments

@johguse
Copy link

johguse commented Jul 26, 2016

Commit 1ee10fd introduced support for v2 api_key naming and tries to fetch the api_key attribute if available. If self._apikey has already been set by the apikey attribute then self._apikey will be overwritten with a (possibly non-existing) environment variable when api_key is missing. This results in a 401 Unauthorized response from Sendgrid as no API-key is present.

To reproduce remove enviroment variable for key and set it directly when constructing SendGridAPIClient:
mySendGrid = sendgrid.SendGridAPIClient(apikey="THISISMYKEY)

The above does not work however the following with v2 naming works and serves as a work-around:
mySendGrid = sendgrid.SendGridAPIClient(api_key="THISISMYKEY)

@thinkingserious
Copy link
Contributor

@johguse,

Thanks for the heads up!

I'll get this one fixed today.

@thinkingserious thinkingserious added type: bug bug in the library status: help wanted requesting help from the community labels Jul 26, 2016
@thinkingserious
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants