Skip to content

Commit

Permalink
Version Bump v3.1.9: Issue #197: api_key / apikey attribute logic inc…
Browse files Browse the repository at this point in the history
…orrect
  • Loading branch information
thinkingserious committed Jul 28, 2016
1 parent e56028b commit 22f406a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## [3.1.9] - 2016-07-26 ##
### Fixed
- [Issue #197](https://github.com/sendgrid/sendgrid-python/issues/197): api_key / apikey attribute logic incorrect
- Thanks to [johguse](https://github.com/johguse) for reporting the bug

## [3.1.8] - 2016-07-25 ##
### Added
- [Troubleshooting](https://github.com/sendgrid/sendgrid-python/blob/master/TROUBLESHOOTING.md) section
Expand Down
2 changes: 1 addition & 1 deletion sendgrid/sendgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, **opts):
self.path = opts.get('path', os.path.abspath(os.path.dirname(__file__)))
self._apikey = opts.get('apikey', os.environ.get('SENDGRID_API_KEY'))
# Support v2 api_key naming
self._apikey = opts.get('api_key', os.environ.get('SENDGRID_API_KEY'))
self._apikey = opts.get('api_key', self._apikey)
self._api_key = self._apikey
self.useragent = 'sendgrid/{0};python'.format(__version__)
self.host = opts.get('host', 'https://api.sendgrid.com')
Expand Down
2 changes: 1 addition & 1 deletion sendgrid/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version_info = (3, 1, 8)
version_info = (3, 1, 9)
__version__ = '.'.join(str(v) for v in version_info)
5 changes: 5 additions & 0 deletions test/test_sendgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def test_apikey_init(self):
self.assertEqual(self.sg.apikey, os.environ.get('SENDGRID_API_KEY'))
# Support the previous naming convention for API keys
self.assertEqual(self.sg.api_key, self.sg.apikey)
my_sendgrid = sendgrid.SendGridAPIClient(apikey="THISISMYKEY")
tmp = os.environ.get('SENDGRID_API_KEY')
os.environ['SENDGRID_API_KEY'] = ""
self.assertEqual(my_sendgrid.apikey, "THISISMYKEY")
os.environ['SENDGRID_API_KEY'] = tmp

def test_useragent(self):
useragent = '{0}{1}{2}'.format('sendgrid/', __version__, ';python')
Expand Down

0 comments on commit 22f406a

Please sign in to comment.