kennethreitz/requests — pull request #1807 by podshumok (2013-12-18 03:03:21+00:00)
Title: cookiejar.iteritems() is broken after 2.1.0 update

Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.1.0'
>>> r = requests.get('http://google.com')
>>> r.cookies
<[Cookie(version=0, name='NID', value='67=WbyIM1gU91bGQ5Y3SjPHQ8_fqtStHiMWGJQ5n2Bt_PwytcmPii7fV7AELJ95cqfSmhAHSJCtFm0bBDZJJoTzQHGGQvk6PT8h78PrwWi96r0K7R9N0KsNCZkkrgJW94dV', port=None, port_specified=False, domain='.google.ru', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=1403146705, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False), Cookie(version=0, name='PREF', value='ID=7c3265d2706e8bea:FF=0:NW=1:TM=1387335505:LM=1387335505:S=LsdqbwGuUdHENT0m', port=None, port_specified=False, domain='.google.ru', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=1450407505, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)]>
>>> dict(r.cookies)
{'PREF': 'ID=7c3265d2706e8bea:FF=0:NW=1:TM=1387335505:LM=1387335505:S=LsdqbwGuUdHENT0m', 'NID': '67=WbyIM1gU91bGQ5Y3SjPHQ8_fqtStHiMWGJQ5n2Bt_PwytcmPii7fV7AELJ95cqfSmhAHSJCtFm0bBDZJJoTzQHGGQvk6PT8h78PrwWi96r0K7R9N0KsNCZkkrgJW94dV'}
>>> r.cookies.items()
[('NID', '67=WbyIM1gU91bGQ5Y3SjPHQ8_fqtStHiMWGJQ5n2Bt_PwytcmPii7fV7AELJ95cqfSmhAHSJCtFm0bBDZJJoTzQHGGQvk6PT8h78PrwWi96r0K7R9N0KsNCZkkrgJW94dV'), ('PREF', 'ID=7c3265d2706e8bea:FF=0:NW=1:TM=1387335505:LM=1387335505:S=LsdqbwGuUdHENT0m')]
>>> r.cookies.iteritems()

>>> list(r.cookies.iteritems())
Traceback (most recent call last):
File "", line 1, in
File "/home/kpp/build/trng_social/venv/lib/python2.7/_abcoll.py", line 387, in iteritems
yield (key, self[key])
File "/home/kpp/build/trng_social/venv/local/lib/python2.7/site-packages/requests/cookies.py", line 267, in __getitem__
return self._find_no_duplicates(name)
File "/home/kpp/build/trng_social/venv/local/lib/python2.7/site-packages/requests/cookies.py", line 322, in _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name=Cookie(version=0, name='NID', value='67=WbyIM1gU91bGQ5Y3SjPHQ8_fqtStHiMWGJQ5n2Bt_PwytcmPii7fV7AELJ95cqfSmhAHSJCtFm0bBDZJJoTzQHGGQvk6PT8h78PrwWi96r0K7R9N0KsNCZkkrgJW94dV', port=None, port_specified=False, domain='.google.ru', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=1403146705, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False), domain=None, path=None"