diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-03-10 21:06:00 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-03-10 21:06:00 (GMT) |
commit | 30781e93b09c035510677f93321b1a69873744fe (patch) | |
tree | 90e2fb8eecfd40ba4a9908afd4cec105173f01b2 | |
parent | 0c5598beaf6984853659572194002f2ea0b20e76 (diff) | |
download | cpython-30781e93b09c035510677f93321b1a69873744fe.zip cpython-30781e93b09c035510677f93321b1a69873744fe.tar.gz cpython-30781e93b09c035510677f93321b1a69873744fe.tar.bz2 |
whatsnew: urllib Request objects are now reusable.
#16464, #17485, #17272.
-rw-r--r-- | Doc/whatsnew/3.4.rst | 13 | ||||
-rw-r--r-- | Misc/NEWS | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index d210a8f..9666e39 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -1562,6 +1562,19 @@ can now be specified by setting a :class:`~urllib.request.Request.method` class attribute on the subclass. (Contributed by Jason R Coombs in :issue:`18978`.) +:class:`~urllib.request.Request` objects are now reusable: if the +:attr:`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` +attributes are modified, all relevant internal properties are updated. This +means, for example, that it is now possible to use the same +:class:`~urllib.request.Request` object in more than one +:meth:`.OpenerDirector.open` call with different *data* arguments, or to +modify a :class:`~urllib.request.Request`\ 's ``url`` rather than recomputing it +from scratch. There is also a new +:meth:`~urllib.request.Request.remove_header` method that can be used to remove +headers from a :class:`~urllib.request.Request`. (Contributed by Alexey +Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and Damien Brecht +and Senthil Kumaran in :issue:`17272`.) + unittest -------- @@ -3053,7 +3053,7 @@ Library to procedurally generate, in an easy way, small test instances. - Issue #17485: Also delete the Request Content-Length header if the data - attribute is deleted. (Follow on to issue 16464). + attribute is deleted. (Follow on to issue Issue #16464). - Issue #15927: CVS now correctly parses escaped newlines and carriage when parsing with quoting turned off. @@ -3477,6 +3477,9 @@ Library list() calls aren't added to filter(), map(), and zip() which are directly passed enumerate(). +- Issue #16464: Reset the Content-Length header when a urllib Request is reused + with new data. + - Issue #12848: The pure Python pickle implementation now treats object lengths as unsigned 32-bit integers, like the C implementation does. Patch by Serhiy Storchaka. |