Message227421
| Author |
karlcow |
| Recipients |
karlcow |
| Date |
2014年09月24日.08:33:53 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1411547633.83.0.465406904057.issue22478@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Ah! the User-Agent (or anything which is in unredirected_hdrs) will not be updated if it has already been set once.
https://hg.python.org/cpython/file/064f6baeb6bd/Lib/urllib/request.py#l1154
>>> headers = dict(request.unredirected_hdrs)
>>> headers
{'User-agent': 'Python-urllib/3.4', 'Host': '127.0.0.1'}
>>> request.headers
{'User-agent': 'Test-Agent', 'Foo': 'cool'}
>>> headers.update(dict((k, v) for k, v in request.headers.items() if k not in headers))
>>> headers
{'User-agent': 'Python-urllib/3.4', 'Host': '127.0.0.1', 'Foo': 'cool'} |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年09月24日 08:33:53 | karlcow | set | recipients:
+ karlcow |
| 2014年09月24日 08:33:53 | karlcow | set | messageid: <1411547633.83.0.465406904057.issue22478@psf.upfronthosting.co.za> |
| 2014年09月24日 08:33:53 | karlcow | link | issue22478 messages |
| 2014年09月24日 08:33:53 | karlcow | create |
|