Changelog =========== **Time flies!!** 3.0.1 (2026-11-01) ++++++++++++++++++++ * Default ``Accept-Encoding`` is ``gzip, 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: * :meth:`Session.putcookie` and init ``cookies`` are host-scoped. A cookie without ``domain`` is bound to the host of the next request and is not sent to other hosts. * :attr:`Response.text` decodes with ``Content-Type`` charset or UTF-8. It no longer guesses gbk/big5 via :func:`mb_code`. * Dropped Python 2 shims: ``basestring``, ``b``, ``u``, and ``Response.next``. 2.4.1 (2026-08-24) ++++++++++++++++++++ * ``no_proxy`` matches IPv6 addresses and CIDR, ``*``, and domain suffixes without treating ``notexample.com`` as ``example.com`` * IPv6 ``Host`` headers use RFC 3986 brackets (``[::1]:8080``) 2.4.0 (2026-08-24) ++++++++++++++++++++ * :attr:`Response.encoding` and :meth:`Response.iter_lines` * ``files`` values may be ``(filename, content, content_type)`` 2.3.0 (2026-08-24) ++++++++++++++++++++ * :attr:`Response.text` uses the charset from ``Content-Type`` when present * Multipart field names and filenames are quoted; file parts use ``mimetypes`` for ``Content-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_context`` for HTTPS * :attr:`Response.ok` and :meth:`Response.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 :meth:`Session.putcookie` or the ``cookies`` argument are still sent to every host. * Add ``json=`` to :func:`request` / :func:`post` / :func:`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 ``Authorization`` and ``Cookie`` on cross-origin redirects * Fix Proxy-Authorization password on redirects * Honor ``NO_PROXY`` when following redirects * Close HTTP connections on the response and on errors * Parse multiple ``Set-Cookie`` headers * Export :class:`Timeout`; reject mutable default arguments * Replace 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 test`` causes SandboxViolation. Improvements: * ``python setup.py test`` handles dependencies automatically. * :func:`random_useragent`: check if ``urlfetch.useragents.list`` exists at the import time. 1.0.1 (2015-01-31) ++++++++++++++++++++ Fixes: * :attr:`urlfetch.Response.history` of 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 :attr:`.Session.cookiestring`. Backwards-incompatible changes: * Remove ``raw_header`` and ``raw_response``. * :func:`random_useragent` now takes a single ``filename`` as parameter. It used to be a list of filenames. * No more ``.title()`` on request headers' keys. * Exceptions are re-designed. :class:`socket.timeout` now is :class:`.Timeout`, ..., see section `Exceptions` in :doc:`reference` for more details. Fixes: * Parsing links: If ``Link`` header is empty, ``[]`` should be returned, not ``[{'url': ''}]``. * Http request's ``Host`` header should include the port. Using ``netloc`` as the http host header is wrong, it could include user:pass. * Redirects: ``Host`` in reqheaders should be ``host:port``. * Streaming decompress not working. 0.6.2 (2014-03-22) ++++++++++++++++++++ Fix: * Http request's host header should include the port. Using ``netloc`` as the http host header is wrong, it could include user:pass. 0.6.1 (2014-03-15) ++++++++++++++++++++ Fix: * Parsing links: If ``Link`` header 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 :class:`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: * :attr:`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: * :func:`urlfetch.random_useragent` raises exception ``[Errno 2] No such file or directory``. * :func:`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. * :func:`urlfetch.encode_multipart` should behave the same as `urllib.urlencode(query, doseq=1)`. * :func:`urlfetch.parse_url` should parse urls like they are HTTP urls. 0.5.3.1 (2013-02-01) ++++++++++++++++++++++ Fix: * :attr:`urlfetch.Response.content` becomes empty after the first access. 0.5.3 (2013-02-01) +++++++++++++++++++ Feature: * NEW :attr:`urlfetch.Response.status_code`, alias of :attr:`urlfetch.Response.status` . * NEW :attr:`urlfetch.Response.total_time`, :attr:`urlfetch.Response.raw_header` and :attr:`urlfetch.Response.raw_response`. * Several properties of :class:`urlfetch.Response` are cached to avoid unnecessary calls, including :attr:`urlfetch.Response.text`, :attr:`urlfetch.Response.json`, :attr:`urlfetch.Response.headers`, :attr:`urlfetch.Response.cookies`, :attr:`urlfetch.Response.cookiestring`, :attr:`urlfetch.Response.raw_header` and :attr:`urlfetch.Response.raw_response`. Fix: * :func:`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: * :func:`~urlfetch.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 :func:`~urlfetch.random_useragent`. 0.5.1 (2012-12-05) +++++++++++++++++++ Fix: * In some platforms ``urlfetch.useragents.list`` located in wrong place. * :func:`~urlfetch.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_redirects`` specify the max redirects allowed within a request. Default is ``0``, which means redirects are not allowed. * Code cleanups 0.4.3 (2012-08-17) +++++++++++++++++++ * Add ``params`` parameter, ``params`` is 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 :class:`urlfetch.Session` to manipulate cookies automatically, share common request headers and cookies. * NEW :attr:`urlfetch.Response.cookies` and :attr:`urlfetch.Response.cookiestring` to 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 that ``urlencode({'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