Skip to content

Commit 22f406a

Browse files
Version Bump v3.1.9: Issue #197: api_key / apikey attribute logic incorrect
1 parent e56028b commit 22f406a

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [3.1.9] - 2016-07-26 ##
5+
### Fixed
6+
- [Issue #197](https://github.com/sendgrid/sendgrid-python/issues/197): api_key / apikey attribute logic incorrect
7+
- Thanks to [johguse](https://github.com/johguse) for reporting the bug
8+
49
## [3.1.8] - 2016-07-25 ##
510
### Added
611
- [Troubleshooting](https://github.com/sendgrid/sendgrid-python/blob/master/TROUBLESHOOTING.md) section

sendgrid/sendgrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, **opts):
1515
self.path = opts.get('path', os.path.abspath(os.path.dirname(__file__)))
1616
self._apikey = opts.get('apikey', os.environ.get('SENDGRID_API_KEY'))
1717
# Support v2 api_key naming
18-
self._apikey = opts.get('api_key', os.environ.get('SENDGRID_API_KEY'))
18+
self._apikey = opts.get('api_key', self._apikey)
1919
self._api_key = self._apikey
2020
self.useragent = 'sendgrid/{0};python'.format(__version__)
2121
self.host = opts.get('host', 'https://api.sendgrid.com')

sendgrid/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version_info = (3, 1, 8)
1+
version_info = (3, 1, 9)
22
__version__ = '.'.join(str(v) for v in version_info)

test/test_sendgrid.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ def test_apikey_init(self):
4040
self.assertEqual(self.sg.apikey, os.environ.get('SENDGRID_API_KEY'))
4141
# Support the previous naming convention for API keys
4242
self.assertEqual(self.sg.api_key, self.sg.apikey)
43+
my_sendgrid = sendgrid.SendGridAPIClient(apikey="THISISMYKEY")
44+
tmp = os.environ.get('SENDGRID_API_KEY')
45+
os.environ['SENDGRID_API_KEY'] = ""
46+
self.assertEqual(my_sendgrid.apikey, "THISISMYKEY")
47+
os.environ['SENDGRID_API_KEY'] = tmp
4348

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

0 commit comments

Comments
 (0)