Changelog¶
Time flies!!
3.0.1 (2026-11-01)¶
Default
Accept-Encodingisgzip, deflate. The previous value included*, so a server could send an encoding the client cannot decode.Header names are matched case-insensitively. An existing name keeps its spelling and the new value replaces it.
3.0.0 (2026-08-24)¶
Backwards-incompatible:
Session.putcookie()and initcookiesare host-scoped. A cookie withoutdomainis bound to the host of the next request and is not sent to other hosts.Response.textdecodes withContent-Typecharset or UTF-8. It no longer guesses gbk/big5 viamb_code().Dropped Python 2 shims:
basestring,b,u, andResponse.next.
2.4.1 (2026-08-24)¶
no_proxymatches IPv6 addresses and CIDR,*, and domain suffixes without treatingnotexample.comasexample.comIPv6
Hostheaders use RFC 3986 brackets ([::1]:8080)
2.4.0 (2026-08-24)¶
Response.encodingandResponse.iter_lines()filesvalues may be(filename, content, content_type)
2.3.0 (2026-08-24)¶
Response.textuses the charset fromContent-Typewhen presentMultipart field names and filenames are quoted; file parts use
mimetypesforContent-Type
2.2.1 (2026-08-24)¶
Classifiers for Python 3.14 and 3.15
2.2.0 (2026-08-24)¶
HTTPS through an HTTP proxy uses CONNECT (
HTTPSConnection.set_tunnel)Optional
ssl_contextfor HTTPSResponse.okandResponse.raise_for_status()
2.1.0 (2026-08-24)¶
Session cookies from responses are stored in a cookiejar and only sent back to matching hosts. Cookies set with
Session.putcookie()or thecookiesargument are still sent to every host.Add
json=torequest()/post()/fetch()Replace the 6000-line user-agent list with a small set of current browsers
2.0.3 (2026-08-24)¶
Require Python >= 3.8 (CI can no longer install 3.5–3.7)
Follow 308 redirects; 307/308 keep the original method and body
301/302/303 redirects no longer resend the request body
Strip
AuthorizationandCookieon cross-origin redirectsFix Proxy-Authorization password on redirects
Honor
NO_PROXYwhen following redirectsClose HTTP connections on the response and on errors
Parse multiple
Set-CookieheadersExport
Timeout; reject mutable default argumentsReplace the Sina network compression tests with local fixtures
2.0.2 (2026-08-24)¶
Publish to PyPI via GitHub Actions Trusted Publishing
Automatically create GitHub Releases with changelog and generated notes
2.0.1 (2023-08-04)¶
Fixed: formdata fieldname
Move import zlib to top level
Change urlparse to urlsplit
setup.py python_required=”>=3.5”
2.0.0 (2023-07-29)¶
Drop support for Python 2.6, 2.7, 3.2, 3.3 and 3.4. urlfetch requires Python >= 3.5 from now on.
Unless specified, assume it’s http proxy
Migrate CI to github actions
1.2.2 (2020-07-11)¶
Fixed: proxy scheme bug
1.2.1 (2020-04-29)¶
Fixed bug: passing context to HTTPSConnection
1.2.0 (2020-04-29)¶
(Contributed by @chmoder) Added validate_certificate to skip validating certificates.
1.1.3 (2019-10-11)¶
(Contributed by @chmoder) Define HTTP request methods as string constants, now we can use urlfetch.request(urlfetch.POST, …).
1.1.2 (2019-03-27)¶
Small optimizations:
Larger chunk when reading response
Read chuncks into list and then join them to bytes
Close response when exception occurs
1.1.1 (2018-12-20)¶
Updated user-agent list.
1.1.0 (2018-11-16)¶
New features:
Support source_address
Support no_proxy environment variable
1.0.3 (2018-01-03)¶
Improvements:
Run tests against Python 3.5 3.6 3.7 and PyPy.
Try to deal with data_files paths.
Some minor changes regarding coding style.
1.0.2 (2015-04-29)¶
Fixes:
python setup.py testcauses SandboxViolation.
Improvements:
python setup.py testhandles dependencies automatically.random_useragent(): check ifurlfetch.useragents.listexists at the import time.
1.0.1 (2015-01-31)¶
Fixes:
urlfetch.Response.historyof a redirected response and its precedent responses should be different.
Improvements:
Simplified some code.
Added some tests.
1.0 (2014-03-22)¶
New features:
Support idna.
Assignable
Session.cookiestring.
Backwards-incompatible changes:
Remove
raw_headerandraw_response.random_useragent()now takes a singlefilenameas parameter. It used to be a list of filenames.No more
.title()on request headers’ keys.Exceptions are re-designed.
socket.timeoutnow isTimeout, …, see section Exceptions in Reference for more details.
Fixes:
Parsing links: If
Linkheader is empty,[]should be returned, not[{'url': ''}].Http request’s
Hostheader should include the port. Usingnetlocas the http host header is wrong, it could include user:pass.Redirects:
Hostin reqheaders should behost:port.Streaming decompress not working.
0.6.2 (2014-03-22)¶
Fix:
Http request’s host header should include the port. Using
netlocas the http host header is wrong, it could include user:pass.
0.6.1 (2014-03-15)¶
Fix:
Parsing links: If
Linkheader is empty,[]should be returned, not[{'url': ''}].
0.6 (2013-08-26)¶
Change:
Remove lazy response introduced in 0.5.6
Remove the dump, dumps, load and loads methods of
urlfetch.Response
0.5.7 (2013-07-08)¶
Fix:
Host header field should include host and port
0.5.6 (2013-07-04)¶
Feature:
Lay response. Read response when you need it.
0.5.5 (2013-06-07)¶
Fix:
fix docstring.
parse_url raise exception for http://foo.com:/
0.5.4.2 (2013-03-31)¶
Feature:
urlfetch.Response.link, links parsed from HTTP Link header.
Fix:
Scheme doesn’t correspond to the new location when following redirects.
0.5.4.1 (2013-03-05)¶
Fix:
urlfetch.random_useragent()raises exception[Errno 2] No such file or directory.urlfetch.encode_multipart()doesn’t use isinstance: (object, class-or-type-or-tuple) correctly.
0.5.4 (2013-02-28)¶
Feature:
HTTP Proxy-Authorization.
Fix:
Fix docstring typos.
urlfetch.encode_multipart()should behave the same as urllib.urlencode(query, doseq=1).urlfetch.parse_url()should parse urls like they are HTTP urls.
0.5.3.1 (2013-02-01)¶
Fix:
urlfetch.Response.contentbecomes empty after the first access.
0.5.3 (2013-02-01)¶
Feature:
NEW
urlfetch.Response.status_code, alias ofurlfetch.Response.status.NEW
urlfetch.Response.total_time,urlfetch.Response.raw_headerandurlfetch.Response.raw_response.Several properties of
urlfetch.Responseare cached to avoid unnecessary calls, includingurlfetch.Response.text,urlfetch.Response.json,urlfetch.Response.headers,urlfetch.Response.cookies,urlfetch.Response.cookiestring,urlfetch.Response.raw_headerandurlfetch.Response.raw_response.
Fix:
urlfetch.mb_code()may silently return incorrect result, since the encode errors are replaced, it should be decode properly and then encode without replace.
0.5.2 (2012-12-24)¶
Feature:
random_useragent()can accept list/tuple/set params and can accept more than one params which specify the paths to check and read from. Below are some examples:>>> ua = random_useragent('file1') >>> ua = random_useragent('file1', 'file2') >>> ua = random_useragent(['file1', 'file2']) >>> ua = random_useragent(['file1', 'file2'], 'file3')
Fix:
Possible infinite loop in
random_useragent().
0.5.1 (2012-12-05)¶
Fix:
In some platforms
urlfetch.useragents.listlocated in wrong place.random_useragent()will never return the first line.Typo in the description of urlfetch.useragents.list (the first line).
0.5.0 (2012-08-23)¶
Redirects support. Parameter
max_redirectsspecify the max redirects allowed within a request. Default is0, which means redirects are not allowed.Code cleanups
0.4.3 (2012-08-17)¶
Add
paramsparameter,paramsis dict or string to attach to request url as querysting.Gzip and deflate support.
0.4.2 (2012-07-31)¶
HTTP(S) proxies support.
0.4.1 (2012-07-04)¶
Streaming support.
0.4.0 (2012-07-01)¶
NEW
urlfetch.Sessionto manipulate cookies automatically, share common request headers and cookies.NEW
urlfetch.Response.cookiesandurlfetch.Response.cookiestringto get response cookie dict and cookie string.
0.3.6 (2012-06-08)¶
Simplify code
Trace method without data and files, according to RFC2612
urlencode(data, 1)so thaturlencode({'param': [1,2,3]})=>'param=1¶m=2¶m=3'
0.3.5 (2012-04-24)¶
Support specifying an IP for the request host, useful for testing API.
0.3.0 (2012-02-28)¶
Python 3 compatible
0.2.2 (2012-02-22)¶
Fix bug: file upload: file should always have a filename
0.2.1 (2012-02-22)¶
More flexible file upload
Rename fetch2 to request
Add auth parameter, instead of put basic authentication info in url
0.1.2 (2011-12-07)¶
Support basic auth
0.1 (2011-12-02)¶
First release