Repository navigation
Support responses like HTTP/1.1 404 öööööööö - #3385
Conversation
| r.status_code = 404 | ||
| r.encoding = None | ||
| assert not r.ok # old behaviour - crashes here | ||
|
|
There was a problem hiding this comment.
Can you move this to a new test, please?
|
Generally speaking I'm not too interested in supporting this kind of logic: servers are really not supposed to be sending non-ASCII-bytes in the reason phrase, and choosing to assume that UTF-8 is being used is really fairly optimistic. However, in the case of |
|
@Lukasa is |
|
|
|
@Lukasa done, updated PR |
| r.reason = six.u('Komponenttia ei löydy').encode('utf-8') | ||
| r.status_code = 404 | ||
| r.encoding = None | ||
| assert not r.ok # old behaviour - crashes here |
There was a problem hiding this comment.
I'd still like this to be its own test, please. =)
|
@Lukasa done |
|
Cool, I'm happy with this as-is. I'd like @sigmavirus24 to ACK as well, if possible. |
|
|
||
| if 400 <= self.status_code < 500: | ||
| http_error_msg = '%s Client Error: %s for url: %s' % (self.status_code, self.reason, self.url) | ||
| http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url) |
There was a problem hiding this comment.
We did officially drop 3.2 support, right? I know we stopped running the tests, but we were supporting it regardless before this.
|
I have a question or two inline. Otherwise, I agree we shouldn't have this exception raised, even if the server is in the wrong. |
0afc68f to
338a6e3
Compare
|
@gugu just use |
|
six is a test dependency of requests though, it's acceptable to use there. |
Sure but there's little sense to using |
|
@sigmavirus24 @lucasa done, updated PR |
|
Looks good to me. @Lukasa, the changes are minimal from when you gave your LGTM, so I'm merging. :) |
|
Thanks @gugu! ✨ 🍰 ✨ 🎆 |
|
y'all emoji-chain thieves! |
|
Is there any plan to make a new Pypi release? We would rather bump (We're affected because of the |
|
We're currently tentatively planning a release for next week. =) |
|
Great |
|
Thank you all for v2.11! |
Currently this code raises UnicodeDecodeError:
requests.get('http://www.voice.fi//lampaan-kiveksia-ja-coca-cola-hulluutta-5-asiaa-joita-et-tiennyt-islannista-122015?utm_source=feed&utm_medium=feed&utm_content=article_link&utm_campaign=feed').okHere is their status:
HTTP/1.1 404 Komponenttia ei löydyThis pull request allow module to handle URLs like this correctly