We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When cookies are passed as UTF8 encoded bytes to the Request constructor, they end up being encoded twice and escaped in the Cookie header.
Request
Cookie
$ scrapy shell (...) In [1]: fetch(scrapy.Request('https://httpbin.org/cookies', cookies={'a': u'á'.encode('utf8')})) In [2]: request.headers['Cookie'] Out[2]: b"a=b'\\xc3\\xa1'" In [3]: print(response.text) { "cookies": { "a": "b'\\xc3\\xa1'" } }
This seems to happen only in Python 3.
$ scrapy version -v Scrapy : 1.5.0 lxml : 4.2.6.0 libxml2 : 2.9.8 cssselect : 1.0.3 parsel : 1.5.1 w3lib : 1.19.0 Twisted : 18.9.0 Python : 3.6.0 (default, Sep 1 2017, 10:59:37) - [GCC 4.8.4] pyOpenSSL : 18.0.0 (OpenSSL 1.1.0j 20 Nov 2018) cryptography : 2.4.2 Platform : Linux-4.4.0-134-generic-x86_64-with-debian-jessie-sid
The text was updated successfully, but these errors were encountered:
This is fixed by #2400
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
When cookies are passed as UTF8 encoded bytes to the
Request
constructor, they end up being encoded twice and escaped in theCookie
header.This seems to happen only in Python 3.
The text was updated successfully, but these errors were encountered: