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

P3K: fix cookie parsing under Python 3.x (+ duplicate import is removed) #2796

Merged
merged 1 commit into from Jan 17, 2013

Conversation

kmike
Copy link
Contributor

@kmike kmike commented Jan 16, 2013

This fixes

WARNING:root:couldn't parse cookie string: b'__utma=96992031.448119963.1345042395.1345203014.1351851470.3; __utmz=96992031.1345042395.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionid=2456b59cebe2a3c7075c6d3f1d136c36; csrftoken=I9knGxQWHWXSUAeOXihXlzs0IJxbss07'
Traceback (most recent call last):
  File "/Users/kmike/envs/pymorphy-33/lib/python3.3/site-packages/ipython-0.14.dev-py3.3.egg/IPython/frontend/html/notebook/handlers.py", line 441, in _inject_cookie_message
    self.request._cookies = http.cookies.SimpleCookie(msg)
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/cookies.py", line 476, in __init__
    self.load(input)
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/cookies.py", line 524, in load
    for key, value in rawdata.items():
AttributeError: 'bytes' object has no attribute 'items'

warning under Python 3.x

@minrk
Copy link
Member

minrk commented Jan 17, 2013

seems simple enough.

minrk added a commit that referenced this pull request Jan 17, 2013
py3k: fix unicode/bytes cookie parsing under Python 3.x
@minrk minrk merged commit ef96c7d into ipython:master Jan 17, 2013
minrk added a commit that referenced this pull request Mar 5, 2013
…ate import is removed)

This fixes
```
WARNING:root:couldn't parse cookie string: b'__utma=96992031.448119963.1345042395.1345203014.1351851470.3; __utmz=96992031.1345042395.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionid=2456b59cebe2a3c7075c6d3f1d136c36; csrftoken=I9knGxQWHWXSUAeOXihXlzs0IJxbss07'
Traceback (most recent call last):
  File "/Users/kmike/envs/pymorphy-33/lib/python3.3/site-packages/ipython-0.14.dev-py3.3.egg/IPython/frontend/html/notebook/handlers.py", line 441, in _inject_cookie_message
    self.request._cookies = http.cookies.SimpleCookie(msg)
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/cookies.py", line 476, in __init__
    self.load(input)
  File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/cookies.py", line 524, in load
    for key, value in rawdata.items():
AttributeError: 'bytes' object has no attribute 'items'
```

warning under Python 3.x
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
py3k: fix unicode/bytes cookie parsing under Python 3.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants