summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Petrov <andrey.petrov@shazow.net>2015-04-01 13:34:33 -0700
committerAndrey Petrov <andrey.petrov@shazow.net>2015-04-01 13:34:33 -0700
commit156b76efd6b1357123ebc209578dd763e87db00d (patch)
tree1c5a85aa3831db606aee186884739cf6c91c9e16
parent7e6bd245581d584b9ebad0da6890143e55a81621 (diff)
downloadurllib3-urllib4.tar.gz
v2.0 release candidate.urllib4
-rw-r--r--.coveragerc4
-rw-r--r--CHANGES.rst8
-rw-r--r--README.rst18
-rw-r--r--docs/Makefile8
-rw-r--r--docs/collections.rst4
-rw-r--r--docs/conf.py14
-rw-r--r--docs/contrib.rst2
-rw-r--r--docs/exceptions.rst4
-rw-r--r--docs/helpers.rst20
-rw-r--r--docs/index.rst106
-rw-r--r--docs/make.bat4
-rw-r--r--docs/managers.rst12
-rw-r--r--docs/pools.rst16
-rw-r--r--docs/security.rst46
-rw-r--r--dummyserver/handlers.py2
-rwxr-xr-xdummyserver/server.py2
-rw-r--r--setup.cfg2
-rw-r--r--setup.py12
-rw-r--r--test/__init__.py4
-rw-r--r--test/benchmark.py4
-rw-r--r--test/contrib/test_pyopenssl.py10
-rw-r--r--test/test_collections.py6
-rw-r--r--test/test_compatibility.py2
-rw-r--r--test/test_connectionpool.py10
-rw-r--r--test/test_exceptions.py4
-rw-r--r--test/test_fields.py4
-rw-r--r--test/test_filepost.py6
-rw-r--r--test/test_poolmanager.py6
-rw-r--r--test/test_proxymanager.py2
-rw-r--r--test/test_response.py6
-rw-r--r--test/test_retry.py8
-rw-r--r--test/test_util.py20
-rw-r--r--test/with_dummyserver/test_connectionpool.py14
-rw-r--r--test/with_dummyserver/test_https.py20
-rw-r--r--test/with_dummyserver/test_poolmanager.py8
-rw-r--r--test/with_dummyserver/test_proxy_poolmanager.py6
-rw-r--r--test/with_dummyserver/test_socketlevel.py14
-rw-r--r--urllib3/__init__.py6
-rw-r--r--urllib3/connection.py4
-rw-r--r--urllib3/connectionpool.py36
-rw-r--r--urllib3/contrib/ntlmpool.py6
-rw-r--r--urllib3/contrib/pyopenssl.py24
-rw-r--r--urllib3/exceptions.py2
-rw-r--r--urllib3/fields.py4
-rw-r--r--urllib3/filepost.py8
-rw-r--r--urllib3/poolmanager.py14
-rw-r--r--urllib3/request.py6
-rw-r--r--urllib3/response.py4
-rw-r--r--urllib3/util/connection.py2
-rw-r--r--urllib3/util/request.py2
-rw-r--r--urllib3/util/retry.py6
-rw-r--r--urllib3/util/ssl_.py14
-rw-r--r--urllib3/util/timeout.py12
53 files changed, 294 insertions, 294 deletions
diff --git a/.coveragerc b/.coveragerc
index 6017701a..430e29af 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,7 +1,7 @@
[run]
omit =
- urllib3/packages/*
- urllib3/contrib/*
+ urllib4/packages/*
+ urllib4/contrib/*
[report]
exclude_lines =
diff --git a/CHANGES.rst b/CHANGES.rst
index 0dc9b4ec..8630dee3 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,8 +1,10 @@
Changes
=======
-dev (master)
-++++++++++++
+2.0.0 (2015-04-01)
+++++++++++++++++++
+
+* Renamed module to urllib4.
* Emit ``InsecurePlatformWarning`` when SSLContext object is missing.
(Issue #558)
@@ -13,8 +15,6 @@ dev (master)
* ``Response.stream()`` returns a generator for chunked responses.
(Issue #560)
-* ... [Short description of non-trivial change.] (Issue #)
-
1.10.2 (2015-02-25)
+++++++++++++++++++
diff --git a/README.rst b/README.rst
index fc6bccf5..3d50b100 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
=======
-urllib3
+urllib4
=======
.. image:: https://travis-ci.org/shazow/urllib3.png?branch=master
@@ -23,13 +23,13 @@ Highlights
- Tested on Python 2.6+, Python 3.2+, and PyPy, with 100% unit test coverage.
- Small and easy to understand codebase perfect for extending and building upon.
For a more comprehensive solution, have a look at
- `Requests <http://python-requests.org/>`_ which is also powered by ``urllib3``.
+ `Requests <http://python-requests.org/>`_ which is also powered by ``urllib4``.
-You might already be using urllib3!
+You might already be using urllib4!
===================================
-``urllib3`` powers `many great Python libraries
+``urllib4`` powers `many great Python libraries
<https://sourcegraph.com/search?q=package+urllib3>`_, including ``pip`` and
``requests``.
@@ -44,7 +44,7 @@ did the work for you.
The Python standard libraries ``urllib`` and ``urllib2`` have little to do
with each other. They were designed to be independent and standalone, each
-solving a different scope of problems, and ``urllib3`` follows in a similar
+solving a different scope of problems, and ``urllib4`` follows in a similar
vein.
@@ -78,9 +78,9 @@ for more nice syntax-highlighted examples.
But, long story short::
- import urllib3
+ import urllib4
- http = urllib3.PoolManager()
+ http = urllib4.PoolManager()
r = http.request('GET', 'http://google.com/')
@@ -108,7 +108,7 @@ you as long as you're running it `inside of a virtualenv
Note that code coverage less than 100% is regarded as a failing run. Some
platform-specific tests are skipped unless run in that platform. To make sure
-the code works in all of urllib3's supported platforms, you can run our ``tox``
+the code works in all of urllib4's supported platforms, you can run our ``tox``
suite::
$ make test-all
@@ -130,7 +130,7 @@ Contributing
a fresh issue to start a discussion around a feature idea or a bug. There is
a *Contributor Friendly* tag for issues that should be ideal for people who
are not very familiar with the codebase yet.
-#. Fork the `urllib3 repository on Github <https://github.com/shazow/urllib3>`_
+#. Fork the `urllib4 repository on Github <https://github.com/shazow/urllib3>`_
to start making your changes.
#. Write a test which shows that the bug was fixed or that the feature works
as expected.
diff --git a/docs/Makefile b/docs/Makefile
index 135c543e..b3453458 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -72,17 +72,17 @@ qthelp:
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/urllib3.qhcp"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/urllib4.qhcp"
@echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/urllib3.qhc"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/urllib4.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/urllib3"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/urllib3"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/urllib4"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/urllib4"
@echo "# devhelp"
epub:
diff --git a/docs/collections.rst b/docs/collections.rst
index b3481402..8386e700 100644
--- a/docs/collections.rst
+++ b/docs/collections.rst
@@ -1,10 +1,10 @@
Collections
===========
-These datastructures are used to implement the behaviour of various urllib3
+These datastructures are used to implement the behaviour of various urllib4
components in a decoupled and application-agnostic design.
-.. automodule:: urllib3._collections
+.. automodule:: urllib4._collections
.. autoclass:: RecentlyUsedContainer
:members:
diff --git a/docs/conf.py b/docs/conf.py
index 7ac8393d..35825103 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# urllib3 documentation build configuration file, created by
+# urllib4 documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 5 13:15:40 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
@@ -22,7 +22,7 @@ import sys
root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, root_path)
-import urllib3
+import urllib4
# -- General configuration -----------------------------------------------------
@@ -54,7 +54,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'urllib3'
+project = u'urllib4'
copyright = u'{year}, Andrey Petrov'.format(year=date.today().year)
# The version info for the project you're documenting, acts as replacement for
@@ -62,7 +62,7 @@ copyright = u'{year}, Andrey Petrov'.format(year=date.today().year)
# built documents.
#
# The short X.Y version.
-version = urllib3.__version__
+version = urllib4.__version__
# The full version, including alpha/beta/rc tags.
release = version
@@ -178,7 +178,7 @@ html_theme = 'nature'
#html_file_suffix = None
# Output file base name for HTML help builder.
-htmlhelp_basename = 'urllib3doc'
+htmlhelp_basename = 'urllib4doc'
# -- Options for LaTeX output --------------------------------------------------
@@ -192,7 +192,7 @@ htmlhelp_basename = 'urllib3doc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'urllib3.tex', u'urllib3 Documentation',
+ ('index', 'urllib4.tex', u'urllib4 Documentation',
u'Andrey Petrov', 'manual'),
]
@@ -225,7 +225,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'urllib3', u'urllib3 Documentation',
+ ('index', 'urllib4', u'urllib4 Documentation',
[u'Andrey Petrov'], 1)
]
diff --git a/docs/contrib.rst b/docs/contrib.rst
index 99c54921..59d046c8 100644
--- a/docs/contrib.rst
+++ b/docs/contrib.rst
@@ -11,4 +11,4 @@ prime time.
SNI-support for Python 2
------------------------
-.. automodule:: urllib3.contrib.pyopenssl
+.. automodule:: urllib4.contrib.pyopenssl
diff --git a/docs/exceptions.rst b/docs/exceptions.rst
index f9e05533..81ea2d54 100644
--- a/docs/exceptions.rst
+++ b/docs/exceptions.rst
@@ -1,7 +1,7 @@
Exceptions
==========
-Custom exceptions defined by urllib3
+Custom exceptions defined by urllib4
-.. automodule:: urllib3.exceptions
+.. automodule:: urllib4.exceptions
:members:
diff --git a/docs/helpers.rst b/docs/helpers.rst
index 79f268ba..7913aca3 100644
--- a/docs/helpers.rst
+++ b/docs/helpers.rst
@@ -2,54 +2,54 @@ Helpers
=======
Useful methods for working with :mod:`httplib`, completely decoupled from
-code specific to **urllib3**.
+code specific to **urllib4**.
Timeouts
--------
-.. automodule:: urllib3.util.timeout
+.. automodule:: urllib4.util.timeout
:members:
Retries
-------
-.. automodule:: urllib3.util.retry
+.. automodule:: urllib4.util.retry
:members:
URL Helpers
-----------
-.. automodule:: urllib3.util.url
+.. automodule:: urllib4.util.url
:members:
Filepost
--------
-.. automodule:: urllib3.filepost
+.. automodule:: urllib4.filepost
:members:
-.. automodule:: urllib3.fields
+.. automodule:: urllib4.fields
:members:
Request
-------
-.. automodule:: urllib3.request
+.. automodule:: urllib4.request
:members:
-.. automodule:: urllib3.util.request
+.. automodule:: urllib4.util.request
:members:
Response
--------
-.. automodule:: urllib3.response
+.. automodule:: urllib4.response
:members:
:undoc-members:
SSL/TLS Helpers
---------------
-.. automodule:: urllib3.util.ssl_
+.. automodule:: urllib4.util.ssl_
:members:
diff --git a/docs/index.rst b/docs/index.rst
index 81ac2d8c..47bf39bd 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,5 +1,5 @@
=====================
-urllib3 Documentation
+urllib4 Documentation
=====================
.. toctree::
@@ -19,17 +19,17 @@ Highlights
- Re-use the same socket connection for multiple requests, with optional
client-side certificate verification. See:
- :class:`~urllib3.connectionpool.HTTPConnectionPool` and
- :class:`~urllib3.connectionpool.HTTPSConnectionPool`
+ :class:`~urllib4.connectionpool.HTTPConnectionPool` and
+ :class:`~urllib4.connectionpool.HTTPSConnectionPool`
- File posting. See:
- :func:`~urllib3.filepost.encode_multipart_formdata`
+ :func:`~urllib4.filepost.encode_multipart_formdata`
- Built-in redirection and retries (optional).
- Supports gzip and deflate decoding. See:
- :func:`~urllib3.response.decode_gzip` and
- :func:`~urllib3.response.decode_deflate`
+ :func:`~urllib4.response.decode_gzip` and
+ :func:`~urllib4.response.decode_deflate`
- Thread-safe and sanity-safe.
@@ -39,7 +39,7 @@ Highlights
- Small and easy to understand codebase perfect for extending and building upon.
For a more comprehensive solution, have a look at
- `Requests <http://python-requests.org/>`_ which is also powered by urllib3.
+ `Requests <http://python-requests.org/>`_ which is also powered by urllib4.
Getting Started
@@ -48,16 +48,16 @@ Getting Started
Installing
----------
-``pip install urllib3`` or fetch the latest source from
-`github.com/shazow/urllib3 <https://github.com/shazow/urllib3>`_.
+``pip install urllib4`` or fetch the latest source from
+`github.com/shazow/urllib4 <https://github.com/shazow/urllib4>`_.
Usage
-----
.. doctest ::
- >>> import urllib3
- >>> http = urllib3.PoolManager()
+ >>> import urllib4
+ >>> http = urllib4.PoolManager()
>>> r = http.request('GET', 'http://example.com/')
>>> r.status
200
@@ -67,14 +67,14 @@ Usage
'data: ...'
-**By default, urllib3 does not verify your HTTPS requests**.
+**By default, urllib4 does not verify your HTTPS requests**.
You'll need to supply a root certificate bundle, or use `certifi
<https://certifi.io/>`_
.. doctest ::
- >>> import urllib3, certifi
- >>> http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
+ >>> import urllib4, certifi
+ >>> http = urllib4.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
>>> r = http.request('GET', 'https://insecure.com/')
Traceback (most recent call last):
...
@@ -84,13 +84,13 @@ For more on making secure SSL/TLS HTTPS requests, read the :ref:`Security
section <security>`.
-urllib3's responses respect the :mod:`io` framework from Python's
+urllib4's responses respect the :mod:`io` framework from Python's
standard library, allowing use of these standard objects for purposes
like buffering:
.. doctest ::
- >>> http = urllib3.PoolManager()
+ >>> http = urllib4.PoolManager()
>>> r = http.urlopen('GET','http://example.com/', preload_content=False)
>>> b = io.BufferedReader(r, 2048)
>>> firstpart = b.read(100)
@@ -101,7 +101,7 @@ like buffering:
Components
==========
-:mod:`urllib3` tries to strike a fine balance between power, extendability, and
+:mod:`urllib4` tries to strike a fine balance between power, extendability, and
sanity. To achieve this, the codebase is a collection of small reusable
utilities and abstractions composed together in a few helpful layers.
@@ -111,40 +111,40 @@ PoolManager
The highest level is the :doc:`PoolManager(...) <managers>`.
-The :class:`~urllib3.poolmanagers.PoolManager` will take care of reusing
+The :class:`~urllib4.poolmanagers.PoolManager` will take care of reusing
connections for you whenever you request the same host. This should cover most
scenarios without significant loss of efficiency, but you can always drop down
to a lower level component for more granular control.
.. doctest ::
- >>> import urllib3
- >>> http = urllib3.PoolManager(10)
+ >>> import urllib4
+ >>> http = urllib4.PoolManager(10)
>>> r1 = http.request('GET', 'http://example.com/')
>>> r2 = http.request('GET', 'http://httpbin.org/')
>>> r3 = http.request('GET', 'http://httpbin.org/get')
>>> len(http.pools)
2
-A :class:`~urllib3.poolmanagers.PoolManager` is a proxy for a collection of
+A :class:`~urllib4.poolmanagers.PoolManager` is a proxy for a collection of
:class:`ConnectionPool` objects. They both inherit from
-:class:`~urllib3.request.RequestMethods` to make sure that their API is
+:class:`~urllib4.request.RequestMethods` to make sure that their API is
similar, so that instances of either can be passed around interchangeably.
ProxyManager
------------
-The :class:`~urllib3.poolmanagers.ProxyManager` is an HTTP proxy-aware
-subclass of :class:`~urllib3.poolmanagers.PoolManager`. It produces a single
-:class:`~urllib3.connectionpool.HTTPConnectionPool` instance for all HTTP
+The :class:`~urllib4.poolmanagers.ProxyManager` is an HTTP proxy-aware
+subclass of :class:`~urllib4.poolmanagers.PoolManager`. It produces a single
+:class:`~urllib4.connectionpool.HTTPConnectionPool` instance for all HTTP
connections and individual per-server:port
-:class:`~urllib3.connectionpool.HTTPSConnectionPool` instances for tunnelled
+:class:`~urllib4.connectionpool.HTTPSConnectionPool` instances for tunnelled
HTTPS connections:
::
- >>> proxy = urllib3.ProxyManager('http://localhost:3128/')
+ >>> proxy = urllib4.ProxyManager('http://localhost:3128/')
>>> r1 = proxy.request('GET', 'http://google.com/')
>>> r2 = proxy.request('GET', 'http://httpbin.org/')
>>> len(proxy.pools)
@@ -160,25 +160,25 @@ ConnectionPool
The next layer is the :doc:`ConnectionPool(...) <pools>`.
-The :class:`~urllib3.connectionpool.HTTPConnectionPool` and
-:class:`~urllib3.connectionpool.HTTPSConnectionPool` classes allow you to
+The :class:`~urllib4.connectionpool.HTTPConnectionPool` and
+:class:`~urllib4.connectionpool.HTTPSConnectionPool` classes allow you to
define a pool of connections to a single host and make requests against this
pool with automatic **connection reusing** and **thread safety**.
When the :mod:`ssl` module is available, then
-:class:`~urllib3.connectionpool.HTTPSConnectionPool` objects can be configured
+:class:`~urllib4.connectionpool.HTTPSConnectionPool` objects can be configured
to check SSL certificates against specific provided certificate authorities.
.. doctest ::
- >>> import urllib3
- >>> conn = urllib3.connection_from_url('http://httpbin.org/')
+ >>> import urllib4
+ >>> conn = urllib4.connection_from_url('http://httpbin.org/')
>>> r1 = conn.request('GET', 'http://httpbin.org/')
>>> r2 = conn.request('GET', '/user-agent')
>>> r3 = conn.request('GET', 'http://example.com')
Traceback (most recent call last):
...
- urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='httpbin.org', port=None): Tried to open a foreign host with url: http://example.com
+ urllib4.exceptions.HostChangedError: HTTPConnectionPool(host='httpbin.org', port=None): Tried to open a foreign host with url: http://example.com
Again, a ConnectionPool is a pool of connections to a specific host. Trying to
access a different host through the same pool will raise a ``HostChangedError``
@@ -186,10 +186,10 @@ exception unless you specify ``assert_same_host=False``. Do this at your own
risk as the outcome is completely dependent on the behaviour of the host server.
If you need to access multiple hosts and don't want to manage your own
-collection of :class:`~urllib3.connectionpool.ConnectionPool` objects, then you
-should use a :class:`~urllib3.poolmanager.PoolManager`.
+collection of :class:`~urllib4.connectionpool.ConnectionPool` objects, then you
+should use a :class:`~urllib4.poolmanager.PoolManager`.
-A :class:`~urllib3.connectionpool.ConnectionPool` is composed of a collection
+A :class:`~urllib4.connectionpool.ConnectionPool` is composed of a collection
of :class:`httplib.HTTPConnection` objects.
@@ -198,13 +198,13 @@ Timeout
A timeout can be set to abort socket operations on individual connections after
the specified duration. The timeout can be defined as a float or an instance of
-:class:`~urllib3.util.timeout.Timeout` which gives more granular configuration
+:class:`~urllib4.util.timeout.Timeout` which gives more granular configuration
over how much time is allowed for different stages of the request. This can be
set for the entire pool or per-request.
.. doctest ::
- >>> from urllib3 import PoolManager, Timeout
+ >>> from urllib4 import PoolManager, Timeout
>>> # Manager with 3 seconds combined timeout.
>>> http = PoolManager(timeout=3.0)
@@ -222,14 +222,14 @@ set for the entire pool or per-request.
>>> # Same Manager but request with a 5 second total timeout.
>>> r = http.request('GET', 'http://httpbin.org/delay/1', timeout=Timeout(total=5.0))
-See the :class:`~urllib3.util.timeout.Timeout` definition for more details.
+See the :class:`~urllib4.util.timeout.Timeout` definition for more details.
Retry
-----
Retries can be configured by passing an instance of
-:class:`~urllib3.util.retry.Retry`, or disabled by passing ``False``, to the
+:class:`~urllib4.util.retry.Retry`, or disabled by passing ``False``, to the
``retries`` parameter.
Redirects are also considered to be a subset of retries but can be configured or
@@ -237,7 +237,7 @@ disabled individually.
::
- >>> from urllib3 import PoolManager, Retry
+ >>> from urllib4 import PoolManager, Retry
>>> # Allow 3 retries total for all requests in this pool. These are the same:
>>> http = PoolManager(retries=3)
@@ -255,7 +255,7 @@ disabled individually.
>>> r = http.request('GET', 'http://httpbin.org/', retries=Retry(connect=5))
-See the :class:`~urllib3.util.retry.Retry` definition for more details.
+See the :class:`~urllib4.util.retry.Retry` definition for more details.
Stream
@@ -263,12 +263,12 @@ Stream
You may also stream your response and get data as they come (e.g. when using
``transfer-encoding: chunked``). In this case, method
-:func:`~urllib3.response.HTTPResponse.stream` will return generator.
+:func:`~urllib4.response.HTTPResponse.stream` will return generator.
::
- >>> from urllib3 import PoolManager
- >>> http = urllib3.PoolManager()
+ >>> from urllib4 import PoolManager
+ >>> http = urllib4.PoolManager()
>>> r = http.request("GET", "http://httpbin.org/stream/3")
>>> r.getheader("transfer-encoding")
@@ -290,11 +290,11 @@ response.
Foundation
----------
-At the very core, just like its predecessors, :mod:`urllib3` is built on top of
+At the very core, just like its predecessors, :mod:`urllib4` is built on top of
:mod:`httplib` -- the lowest level HTTP library included in the Python
standard library.
-To aid the limited functionality of the :mod:`httplib` module, :mod:`urllib3`
+To aid the limited functionality of the :mod:`httplib` module, :mod:`urllib4`
provides various helper methods which are used with the higher level components
but can also be used independently.
@@ -318,11 +318,11 @@ prime time.
Contributing
============
-#. `Check for open issues <https://github.com/shazow/urllib3/issues>`_ or open
+#. `Check for open issues <https://github.com/shazow/urllib4/issues>`_ or open
a fresh issue to start a discussion around a feature idea or a bug. There is
a *Contributor Friendly* tag for issues that should be ideal for people who
are not very familiar with the codebase yet.
-#. Fork the `urllib3 repository on Github <https://github.com/shazow/urllib3>`_
+#. Fork the `urllib4 repository on Github <https://github.com/shazow/urllib4>`_
to start making your changes.
#. Write a test which shows that the bug was fixed or that the feature works
as expected.
@@ -333,7 +333,7 @@ Contributing
Sponsorship
===========
-Please consider sponsoring urllib3 development, especially if your company
+Please consider sponsoring urllib4 development, especially if your company
benefits from this library.
* **Project Grant**: A grant for contiguous full-time development has the
@@ -346,11 +346,11 @@ benefits from this library.
* **One-off**: Development will continue regardless of funding, but donations help move
things further along quicker as the maintainer can allocate more time off to
- work on urllib3 specifically.
+ work on urllib4 specifically.
.. raw:: html
- <a href="https://donorbox.org/personal-sponsor-urllib3" style="background-color:#1275ff;color:#fff;text-decoration:none;font-family:Verdana,sans-serif;display:inline-block;font-size:14px;padding:7px 16px;border-radius:5px;margin-right:2em;vertical-align:top;border:1px solid rgba(160,160,160,0.5);background-image:linear-gradient(#7dc5ee,#008cdd 85%,#30a2e4);box-shadow:inset 0 1px 0 rgba(255,255,255,0.25);">Sponsor with Credit Card</a>
+ <a href="https://donorbox.org/personal-sponsor-urllib4" style="background-color:#1275ff;color:#fff;text-decoration:none;font-family:Verdana,sans-serif;display:inline-block;font-size:14px;padding:7px 16px;border-radius:5px;margin-right:2em;vertical-align:top;border:1px solid rgba(160,160,160,0.5);background-image:linear-gradient(#7dc5ee,#008cdd 85%,#30a2e4);box-shadow:inset 0 1px 0 rgba(255,255,255,0.25);">Sponsor with Credit Card</a>
<a class="coinbase-button" data-code="137087702cf2e77ce400d53867b164e6" href="https://coinbase.com/checkouts/137087702cf2e77ce400d53867b164e6">Sponsor with Bitcoin</a><script src="https://coinbase.com/assets/button.js" type="text/javascript"></script>
@@ -362,7 +362,7 @@ Recent Sponsors
---------------
Huge thanks to all the companies and individuals who financially contributed to
-the development of urllib3. Please send a PR if you've donated and would like
+the development of urllib4. Please send a PR if you've donated and would like
to be listed.
* `Stripe <https://stripe.com/>`_ (June 23, 2014)
diff --git a/docs/make.bat b/docs/make.bat
index 41aa35b9..39061b84 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -95,9 +95,9 @@ if "%1" == "qthelp" (
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
- echo.^> qcollectiongenerator %BUILDDIR%\qthelp\urllib3.qhcp
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\urllib4.qhcp
echo.To view the help file:
- echo.^> assistant -collectionFile %BUILDDIR%\qthelp\urllib3.ghc
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\urllib4.ghc
goto end
)
diff --git a/docs/managers.rst b/docs/managers.rst
index 6c841b75..cf4d8014 100644
--- a/docs/managers.rst
+++ b/docs/managers.rst
@@ -1,7 +1,7 @@
PoolManager
===========
-.. automodule:: urllib3.poolmanager
+.. automodule:: urllib4.poolmanager
A pool manager is an abstraction for a collection of
:doc:`ConnectionPools <pools>`.
@@ -12,7 +12,7 @@ so you don't have to.
.. doctest ::
- >>> from urllib3 import PoolManager
+ >>> from urllib4 import PoolManager
>>> manager = PoolManager(10)
>>> r = manager.request('GET', 'http://example.com')
>>> r.headers['server']
@@ -41,7 +41,7 @@ as a context manager.
.. doctest ::
- >>> from urllib3 import PoolManager
+ >>> from urllib4 import PoolManager
>>> with PoolManager(10) as manager:
... r = manager.request('GET', 'http://example.com')
... r = manager.request('GET', 'http://httpbin.org/')
@@ -52,7 +52,7 @@ as a context manager.
0
You can read more about the implementation and the various adjustable variables
-within :class:`~urllib3._collections.RecentlyUsedContainer`.
+within :class:`~urllib4._collections.RecentlyUsedContainer`.
API
---
@@ -65,9 +65,9 @@ ProxyManager
:class:`.ProxyManager` is an HTTP proxy-aware subclass of :class:`.PoolManager`.
It produces a single
-:class:`~urllib3.connectionpool.HTTPConnectionPool` instance for all HTTP
+:class:`~urllib4.connectionpool.HTTPConnectionPool` instance for all HTTP
connections and individual per-server:port
-:class:`~urllib3.connectionpool.HTTPSConnectionPool` instances for tunnelled
+:class:`~urllib4.connectionpool.HTTPSConnectionPool` instances for tunnelled
HTTPS connections.
API
diff --git a/docs/pools.rst b/docs/pools.rst
index 9cc2be9a..cbf46604 100644
--- a/docs/pools.rst
+++ b/docs/pools.rst
@@ -1,7 +1,7 @@
ConnectionPools
===============
-.. automodule:: urllib3.connectionpool
+.. automodule:: urllib4.connectionpool
A connection pool is a container for a collection of connections to a specific
host.
@@ -11,10 +11,10 @@ If you need to make requests to the same host repeatedly, then you should use a
.. doctest ::
- >>> from urllib3 import HTTPConnectionPool
+ >>> from urllib4 import HTTPConnectionPool
>>> pool = HTTPConnectionPool('ajax.googleapis.com', maxsize=1)
>>> r = pool.request('GET', '/ajax/services/search/web',
- ... fields={'q': 'urllib3', 'v': '1.0'})
+ ... fields={'q': 'urllib4', 'v': '1.0'})
>>> r.status
200
>>> r.headers['content-type']
@@ -40,10 +40,10 @@ pool after usage.
.. doctest ::
- >>> from urllib3 import HTTPConnectionPool
+ >>> from urllib4 import HTTPConnectionPool
>>> with HTTPConnectionPool('ajax.googleapis.com', maxsize=1) as pool:
... r = pool.request('GET', '/ajax/services/search/web',
- ... fields={'q': 'urllib3', 'v': '1.0'})
+ ... fields={'q': 'urllib4', 'v': '1.0'})
... print(pool.pool)
...
<queue.LifoQueue object at 0x7f67367dfcf8>
@@ -61,7 +61,7 @@ ConnectionPools more easily:
API
---
-:mod:`urllib3.connectionpool` comes with two connection pools:
+:mod:`urllib4.connectionpool` comes with two connection pools:
.. autoclass:: HTTPConnectionPool
:members:
@@ -74,12 +74,12 @@ All of these pools inherit from a common base class:
.. autoclass:: ConnectionPool
-.. module:: urllib3.connection
+.. module:: urllib4.connection
Related Classes
---------------
-urllib3 implements its own :class:`HTTPConnection` object to allow for more
+urllib4 implements its own :class:`HTTPConnection` object to allow for more
flexibility than the standard library's implementation.
.. autoclass:: HTTPConnection
diff --git a/docs/security.rst b/docs/security.rst
index 881730e7..52bf68d9 100644
--- a/docs/security.rst
+++ b/docs/security.rst
@@ -3,7 +3,7 @@
Security: Verified HTTPS with SSL/TLS
=====================================
-Very important fact: **By default, urllib3 does not verify HTTPS requests.**
+Very important fact: **By default, urllib4 does not verify HTTPS requests.**
The historic reason for this is that we rely on ``httplib`` for some of the
HTTP protocol implementation, and ``httplib`` does not verify requests out of
@@ -30,7 +30,7 @@ and you'll need to re-install it. Read
for details.
Otherwise, if ``ssl`` imported cleanly, then we're ready to setup our certificates:
-:ref:`certifi-with-urllib3`.
+:ref:`certifi-with-urllib4`.
Enabling SSL on Google AppEngine
@@ -48,9 +48,9 @@ to `enable using sockets
<https://developers.google.com/appengine/docs/python/sockets/>`_.
-.. _certifi-with-urllib3:
+.. _certifi-with-urllib4:
-Using Certifi with urllib3
+Using Certifi with urllib4
--------------------------
`Certifi <http://certifi.io/>`_ is a package which ships with Mozilla's root
@@ -62,10 +62,10 @@ certificates for easy programmatic access.
2. Setup your pool to require a certificate and provide the certifi bundle::
- import urllib3
+ import urllib4
import certifi
- http = urllib3.PoolManager(
+ http = urllib4.PoolManager(
cert_reqs='CERT_REQUIRED', # Force certificate check.
ca_certs=certifi.where(), # Path to the Certifi bundle.
)
@@ -73,7 +73,7 @@ certificates for easy programmatic access.
# You're ready to make verified HTTPS requests.
try:
r = http.request('GET', 'https://example.com/')
- except urllib3.exceptions.SSLError as e:
+ except urllib4.exceptions.SSLError as e:
# Handle incorrect certificate error.
...
@@ -94,11 +94,11 @@ For example, on most Linux distributions they're at
Once you find your root certificate file::
- import urllib3
+ import urllib4
ca_certs = "/etc/ssl/certs/ca-certificates.crt" # Or wherever it lives.
- http = urllib3.PoolManager(
+ http = urllib4.PoolManager(
cert_reqs='CERT_REQUIRED', # Force certificate check.
ca_certs=ca_certs, # Path to your certificate bundle.
)
@@ -106,7 +106,7 @@ Once you find your root certificate file::
# You're ready to make verified HTTPS requests.
try:
r = http.request('GET', 'https://example.com/')
- except urllib3.exceptions.SSLError as e:
+ except urllib4.exceptions.SSLError as e:
# Handle incorrect certificate error.
...
@@ -128,15 +128,15 @@ packages::
$ pip install pyopenssl ndg-httpsclient pyasn1
-Once the packages are installed, you can tell urllib3 to switch the ssl backend
-to PyOpenSSL with :func:`~urllib3.contrib.pyopenssl.inject_into_urllib3`::
+Once the packages are installed, you can tell urllib4 to switch the ssl backend
+to PyOpenSSL with :func:`~urllib4.contrib.pyopenssl.inject_into_urllib4`::
- import urllib3.contrib.pyopenssl
- urllib3.contrib.pyopenssl.inject_into_urllib3()
+ import urllib4.contrib.pyopenssl
+ urllib4.contrib.pyopenssl.inject_into_urllib4()
-Now you can continue using urllib3 as you normally would.
+Now you can continue using urllib4 as you normally would.
-For more details, check the :mod:`~urllib3.contrib.pyopenssl` module.
+For more details, check the :mod:`~urllib4.contrib.pyopenssl` module.
.. _insecurerequestwarning:
@@ -148,18 +148,18 @@ InsecureRequestWarning
Unverified HTTPS requests will trigger a warning via Python's ``warnings`` module::
- urllib3/connectionpool.py:736: InsecureRequestWarning: Unverified HTTPS
+ urllib4/connectionpool.py:736: InsecureRequestWarning: Unverified HTTPS
request is being made. Adding certificate verification is strongly advised.
- See: https://urllib3.readthedocs.org/en/latest/security.html
+ See: https://urllib4.readthedocs.org/en/latest/security.html
This would be a great time to enable HTTPS verification:
-:ref:`certifi-with-urllib3`.
+:ref:`certifi-with-urllib4`.
If you know what you're doing and would like to disable this and other warnings,
-you can use :func:`~urllib3.disable_warnings`::
+you can use :func:`~urllib4.disable_warnings`::
- import urllib3
- urllib3.disable_warnings()
+ import urllib4
+ urllib4.disable_warnings()
Making unverified HTTPS requests is strongly discouraged. ˙ ͜ʟ˙
@@ -178,7 +178,7 @@ InsecurePlatformWarning
Certain Python platforms (specifically, versions of Python earlier than 2.7.9)
have restrictions in their ``ssl`` module that limit the configuration that
-``urllib3`` can apply. In particular, this can cause HTTPS requests that would
+``urllib4`` can apply. In particular, this can cause HTTPS requests that would
succeed on more featureful platforms to fail, and can cause certain security
features to be unavailable.
diff --git a/dummyserver/handlers.py b/dummyserver/handlers.py
index 72faa1aa..ea8f398c 100644
--- a/dummyserver/handlers.py
+++ b/dummyserver/handlers.py
@@ -211,7 +211,7 @@ def _parse_header(line):
"""
import tornado.httputil
import email.utils
- from urllib3.packages import six
+ from urllib4.packages import six
if not six.PY3:
line = line.encode('utf-8')
parts = tornado.httputil._parseparam(';' + line)
diff --git a/dummyserver/server.py b/dummyserver/server.py
index 73f84372..635581ef 100755
--- a/dummyserver/server.py
+++ b/dummyserver/server.py
@@ -15,7 +15,7 @@ import threading
import socket
import warnings
-from urllib3.exceptions import HTTPWarning
+from urllib4.exceptions import HTTPWarning
from tornado.platform.auto import set_close_exec
import tornado.wsgi
diff --git a/setup.cfg b/setup.cfg
index 200b7616..4a908563 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,7 +1,7 @@
[nosetests]
logging-clear-handlers=true
with-coverage=true
-cover-package=urllib3
+cover-package=urllib4
# no rounding problems here
cover-min-percentage=100
cover-erase=true
diff --git a/setup.py b/setup.py
index f6383770..677d16e2 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@ except ImportError:
base_path = os.path.dirname(__file__)
# Get the version (borrowed from SQLAlchemy)
-fp = open(os.path.join(base_path, 'urllib3', '__init__.py'))
+fp = open(os.path.join(base_path, 'urllib4', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'",
re.S).match(fp.read()).group(1)
fp.close()
@@ -21,7 +21,7 @@ fp.close()
version = VERSION
-setup(name='urllib3',
+setup(name='urllib4',
version=version,
description="HTTP library with thread-safe connection pooling, file post, and more.",
long_description=open('README.rst').read() + '\n\n' + open('CHANGES.rst').read(),
@@ -39,11 +39,11 @@ setup(name='urllib3',
keywords='urllib httplib threadsafe filepost http https ssl pooling',
author='Andrey Petrov',
author_email='andrey.petrov@shazow.net',
- url='http://urllib3.readthedocs.org/',
+ url='http://urllib4.readthedocs.org/',
license='MIT',
- packages=['urllib3',
- 'urllib3.packages', 'urllib3.packages.ssl_match_hostname',
- 'urllib3.contrib', 'urllib3.util',
+ packages=['urllib4',
+ 'urllib4.packages', 'urllib4.packages.ssl_match_hostname',
+ 'urllib4.contrib', 'urllib4.util',
],
requires=[],
tests_require=[
diff --git a/test/__init__.py b/test/__init__.py
index 2fce71ce..98d838c5 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -6,8 +6,8 @@ import socket
from nose.plugins.skip import SkipTest
-from urllib3.exceptions import MaxRetryError, HTTPWarning
-from urllib3.packages import six
+from urllib4.exceptions import MaxRetryError, HTTPWarning
+from urllib4.packages import six
# We need a host that will not immediately close the connection with a TCP
# Reset. SO suggests this hostname
diff --git a/test/benchmark.py b/test/benchmark.py
index 242e72fc..05cddb16 100644
--- a/test/benchmark.py
+++ b/test/benchmark.py
@@ -11,7 +11,7 @@ import time
import urllib
sys.path.append('../')
-import urllib3
+import urllib4
# URLs to download. Doesn't matter as long as they're from the same host, so we
@@ -46,7 +46,7 @@ def urllib_get(url_list):
def pool_get(url_list):
assert url_list
- pool = urllib3.PoolManager()
+ pool = urllib4.PoolManager()
for url in url_list:
now = time.time()
r = pool.request('GET', url, assert_same_host=False)
diff --git a/test/contrib/test_pyopenssl.py b/test/contrib/test_pyopenssl.py
index 5d575277..7edaa4e7 100644
--- a/test/contrib/test_pyopenssl.py
+++ b/test/contrib/test_pyopenssl.py
@@ -1,12 +1,12 @@
from nose.plugins.skip import SkipTest
-from urllib3.packages import six
+from urllib4.packages import six
if six.PY3:
raise SkipTest('Testing of PyOpenSSL disabled on PY3')
try:
- from urllib3.contrib.pyopenssl import (inject_into_urllib3,
- extract_from_urllib3)
+ from urllib4.contrib.pyopenssl import (inject_into_urllib4,
+ extract_from_urllib4)
except ImportError as e:
raise SkipTest('Could not import PyOpenSSL: %r' % e)
@@ -16,8 +16,8 @@ from ..with_dummyserver.test_socketlevel import TestSNI, TestSocketClosing
def setup_module():
- inject_into_urllib3()
+ inject_into_urllib4()
def teardown_module():
- extract_from_urllib3()
+ extract_from_urllib4()
diff --git a/test/test_collections.py b/test/test_collections.py
index 0b365120..aa4629d8 100644
--- a/test/test_collections.py
+++ b/test/test_collections.py
@@ -1,10 +1,10 @@
import unittest
-from urllib3._collections import (
+from urllib4._collections import (
HTTPHeaderDict,
RecentlyUsedContainer as Container
)
-from urllib3.packages import six
+from urllib4.packages import six
xrange = six.moves.xrange
from nose.plugins.skip import SkipTest
@@ -155,7 +155,7 @@ class TestHTTPHeaderDict(unittest.TestCase):
self.assertTrue('ab' in h)
def test_create_from_iterator(self):
- teststr = 'urllib3ontherocks'
+ teststr = 'urllib4ontherocks'
h = HTTPHeaderDict((c, c*5) for c in teststr)
self.assertEqual(len(h), len(set(teststr)))
diff --git a/test/test_compatibility.py b/test/test_compatibility.py
index 05ee4def..a26970c9 100644
--- a/test/test_compatibility.py
+++ b/test/test_compatibility.py
@@ -1,7 +1,7 @@
import unittest
import warnings
-from urllib3.connection import HTTPConnection
+from urllib4.connection import HTTPConnection
class TestVersionCompatibility(unittest.TestCase):
diff --git a/test/test_connectionpool.py b/test/test_connectionpool.py
index 0718b0f8..27defb8a 100644
--- a/test/test_connectionpool.py
+++ b/test/test_connectionpool.py
@@ -1,13 +1,13 @@
import unittest
-from urllib3.connectionpool import (
+from urllib4.connectionpool import (
connection_from_url,
HTTPConnection,
HTTPConnectionPool,
)
-from urllib3.util.timeout import Timeout
-from urllib3.packages.ssl_match_hostname import CertificateError
-from urllib3.exceptions import (
+from urllib4.util.timeout import Timeout
+from urllib4.packages.ssl_match_hostname import CertificateError
+from urllib4.exceptions import (
ClosedPoolError,
EmptyPoolError,
HostChangedError,
@@ -153,7 +153,7 @@ class TestConnectionPool(unittest.TestCase):
# The pool should never be empty, and with these two exceptions being raised,
# a retry will be triggered, but that retry will fail, eventually raising
# MaxRetryError, not EmptyPoolError
- # See: https://github.com/shazow/urllib3/issues/76
+ # See: https://github.com/shazow/urllib4/issues/76
pool._make_request = lambda *args, **kwargs: _raise(HTTPException)
self.assertRaises(MaxRetryError, pool.request,
'GET', '/', retries=1, pool_timeout=0.01)
diff --git a/test/test_exceptions.py b/test/test_exceptions.py
index 4190a61c..49a54a16 100644
--- a/test/test_exceptions.py
+++ b/test/test_exceptions.py
@@ -1,11 +1,11 @@
import unittest
import pickle
-from urllib3.exceptions import (HTTPError, MaxRetryError, LocationParseError,
+from urllib4.exceptions import (HTTPError, MaxRetryError, LocationParseError,
ClosedPoolError, EmptyPoolError,
HostChangedError, ReadTimeoutError,
ConnectTimeoutError)
-from urllib3.connectionpool import HTTPConnectionPool
+from urllib4.connectionpool import HTTPConnectionPool
diff --git a/test/test_fields.py b/test/test_fields.py
index cdec68b7..fba221c6 100644
--- a/test/test_fields.py
+++ b/test/test_fields.py
@@ -1,7 +1,7 @@
import unittest
-from urllib3.fields import guess_content_type, RequestField
-from urllib3.packages.six import u
+from urllib4.fields import guess_content_type, RequestField
+from urllib4.packages.six import u
class TestRequestField(unittest.TestCase):
diff --git a/test/test_filepost.py b/test/test_filepost.py
index 390dbb33..530aea4d 100644
--- a/test/test_filepost.py
+++ b/test/test_filepost.py
@@ -1,8 +1,8 @@
import unittest
-from urllib3.filepost import encode_multipart_formdata, iter_fields
-from urllib3.fields import RequestField
-from urllib3.packages.six import b, u
+from urllib4.filepost import encode_multipart_formdata, iter_fields
+from urllib4.fields import RequestField
+from urllib4.packages.six import b, u
BOUNDARY = '!! test boundary !!'
diff --git a/test/test_poolmanager.py b/test/test_poolmanager.py
index 6195d516..e7e19ab4 100644
--- a/test/test_poolmanager.py
+++ b/test/test_poolmanager.py
@@ -1,8 +1,8 @@
import unittest
-from urllib3.poolmanager import PoolManager
-from urllib3 import connection_from_url
-from urllib3.exceptions import (
+from urllib4.poolmanager import PoolManager
+from urllib4 import connection_from_url
+from urllib4.exceptions import (
ClosedPoolError,
LocationValueError,
)
diff --git a/test/test_proxymanager.py b/test/test_proxymanager.py
index e7b5c486..65a0b836 100644
--- a/test/test_proxymanager.py
+++ b/test/test_proxymanager.py
@@ -1,6 +1,6 @@
import unittest
-from urllib3.poolmanager import ProxyManager
+from urllib4.poolmanager import ProxyManager
class TestProxyManager(unittest.TestCase):
diff --git a/test/test_response.py b/test/test_response.py
index e74fd5d3..78a5b5c6 100644
--- a/test/test_response.py
+++ b/test/test_response.py
@@ -6,8 +6,8 @@ try:
import http.client as httplib
except ImportError:
import httplib
-from urllib3.response import HTTPResponse
-from urllib3.exceptions import DecodeError, ResponseNotChunked
+from urllib4.response import HTTPResponse
+from urllib4.exceptions import DecodeError, ResponseNotChunked
from base64 import b64decode
@@ -380,7 +380,7 @@ class TestResponse(unittest.TestCase):
self.assertRaises(StopIteration, next, stream)
def test_mock_httpresponse_stream(self):
- # Mock out a HTTP Request that does enough to make it through urllib3's
+ # Mock out a HTTP Request that does enough to make it through urllib4's
# read() and close() calls, and also exhausts and underlying file
# object.
class MockHTTPRequest(object):
diff --git a/test/test_retry.py b/test/test_retry.py
index 421e5086..febbfe27 100644
--- a/test/test_retry.py
+++ b/test/test_retry.py
@@ -1,9 +1,9 @@
import unittest
-from urllib3.response import HTTPResponse
-from urllib3.packages.six.moves import xrange
-from urllib3.util.retry import Retry
-from urllib3.exceptions import (
+from urllib4.response import HTTPResponse
+from urllib4.packages.six.moves import xrange
+from urllib4.util.retry import Retry
+from urllib4.exceptions import (
ConnectTimeoutError,
MaxRetryError,
ReadTimeoutError,
diff --git a/test/test_util.py b/test/test_util.py
index ba26af5a..622d95cc 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -6,27 +6,27 @@ from itertools import chain
from mock import patch, Mock
-from urllib3 import add_stderr_logger, disable_warnings
-from urllib3.util.request import make_headers
-from urllib3.util.timeout import Timeout
-from urllib3.util.url import (
+from urllib4 import add_stderr_logger, disable_warnings
+from urllib4.util.request import make_headers
+from urllib4.util.timeout import Timeout
+from urllib4.util.url import (
get_host,
parse_url,
split_first,
Url,
)
-from urllib3.util.ssl_ import (
+from urllib4.util.ssl_ import (
resolve_cert_reqs,
ssl_wrap_socket,
)
-from urllib3.exceptions import (
+from urllib4.exceptions import (
LocationParseError,
TimeoutStateError,
InsecureRequestWarning,
SSLError,
)
-from urllib3.util import is_fp_closed, ssl_
+from urllib4.util import is_fp_closed, ssl_
from . import clear_warnings
@@ -227,7 +227,7 @@ class TestUtil(unittest.TestCase):
def test_add_stderr_logger(self):
handler = add_stderr_logger(level=logging.INFO) # Don't actually print debug
- logger = logging.getLogger('urllib3')
+ logger = logging.getLogger('urllib4')
self.assertTrue(handler in logger.handlers)
logger.debug('Testing add_stderr_logger')
@@ -278,7 +278,7 @@ class TestUtil(unittest.TestCase):
self.assertTrue('int or float' in str(e))
- @patch('urllib3.util.timeout.current_time')
+ @patch('urllib4.util.timeout.current_time')
def test_timeout(self, current_time):
timeout = Timeout(total=3)
@@ -325,7 +325,7 @@ class TestUtil(unittest.TestCase):
self.assertEqual(str(timeout), "Timeout(connect=1, read=None, total=3)")
- @patch('urllib3.util.timeout.current_time')
+ @patch('urllib4.util.timeout.current_time')
def test_timeout_elapsed(self, current_time):
current_time.return_value = TIMEOUT_EPOCH
timeout = Timeout(total=3)
diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py
index a789e9bd..0cc40003 100644
--- a/test/with_dummyserver/test_connectionpool.py
+++ b/test/with_dummyserver/test_connectionpool.py
@@ -18,11 +18,11 @@ from .. import (
TARPIT_HOST, VALID_SOURCE_ADDRESSES, INVALID_SOURCE_ADDRESSES,
)
from ..port_helpers import find_unused_port
-from urllib3 import (
+from urllib4 import (
encode_multipart_formdata,
HTTPConnectionPool,
)
-from urllib3.exceptions import (
+from urllib4.exceptions import (
ConnectTimeoutError,
EmptyPoolError,
DecodeError,
@@ -30,9 +30,9 @@ from urllib3.exceptions import (
ReadTimeoutError,
ProtocolError,
)
-from urllib3.packages.six import b, u
-from urllib3.util.retry import Retry
-from urllib3.util.timeout import Timeout
+from urllib4.packages.six import b, u
+from urllib4.util.retry import Retry
+from urllib4.util.timeout import Timeout
import tornado
from dummyserver.testcase import HTTPDummyServerTestCase
@@ -40,7 +40,7 @@ from dummyserver.server import NoIPv6Warning
from nose.tools import timed
-log = logging.getLogger('urllib3.connectionpool')
+log = logging.getLogger('urllib4.connectionpool')
log.setLevel(logging.NOTSET)
log.addHandler(logging.StreamHandler(sys.stdout))
@@ -680,7 +680,7 @@ class TestRetry(HTTPDummyServerTestCase):
self.assertEqual(resp.status, 418)
def test_default_method_whitelist_retried(self):
- """ urllib3 should retry methods in the default method whitelist """
+ """ urllib4 should retry methods in the default method whitelist """
retry = Retry(total=1, status_forcelist=[418])
resp = self.pool.request('OPTIONS', '/successful_retry',
headers={'test-name': 'test_default_whitelist'},
diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py
index f3e00acf..0ccf22af 100644
--- a/test/with_dummyserver/test_https.py
+++ b/test/with_dummyserver/test_https.py
@@ -18,13 +18,13 @@ from test import (
TARPIT_HOST,
clear_warnings,
)
-from urllib3 import HTTPSConnectionPool
-from urllib3.connection import (
+from urllib4 import HTTPSConnectionPool
+from urllib4.connection import (
VerifiedHTTPSConnection,
UnverifiedHTTPSConnection,
RECENT_DATE,
)
-from urllib3.exceptions import (
+from urllib4.exceptions import (
SSLError,
ReadTimeoutError,
ConnectTimeoutError,
@@ -32,10 +32,10 @@ from urllib3.exceptions import (
SystemTimeWarning,
InsecurePlatformWarning,
)
-from urllib3.util.timeout import Timeout
+from urllib4.util.timeout import Timeout
-log = logging.getLogger('urllib3.connectionpool')
+log = logging.getLogger('urllib4.connectionpool')
log.setLevel(logging.NOTSET)
log.addHandler(logging.StreamHandler(sys.stdout))
@@ -159,17 +159,17 @@ class TestHTTPS(HTTPSDummyServerTestCase):
certificates. Since this file is used by many components of the OS,
such as curl, apt-get, etc., we decided to not touch it, in order to
not compromise the security of the OS running the test suite (typically
- urllib3 developer's OS).
+ urllib4 developer's OS).
This test assumes that httpbin.org uses a certificate signed by a well
known Certificate Authority.
"""
try:
- import urllib3.contrib.pyopenssl
+ import urllib4.contrib.pyopenssl
except ImportError:
raise SkipTest('Test requires PyOpenSSL')
- if (urllib3.connection.ssl_wrap_socket is
- urllib3.contrib.pyopenssl.orig_connection_ssl_wrap_socket):
+ if (urllib4.connection.ssl_wrap_socket is
+ urllib4.contrib.pyopenssl.orig_connection_ssl_wrap_socket):
# Not patched
raise SkipTest('Test should only be run after PyOpenSSL '
'monkey patching')
@@ -371,7 +371,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
def test_ssl_wrong_system_time(self):
self._pool.cert_reqs = 'CERT_REQUIRED'
self._pool.ca_certs = DEFAULT_CA
- with mock.patch('urllib3.connection.datetime') as mock_date:
+ with mock.patch('urllib4.connection.datetime') as mock_date:
mock_date.date.today.return_value = datetime.date(1970, 1, 1)
with warnings.catch_warnings(record=True) as w:
diff --git a/test/with_dummyserver/test_poolmanager.py b/test/with_dummyserver/test_poolmanager.py
index 7e51c730..9a977dc5 100644
--- a/test/with_dummyserver/test_poolmanager.py
+++ b/test/with_dummyserver/test_poolmanager.py
@@ -3,10 +3,10 @@ import json
from dummyserver.testcase import (HTTPDummyServerTestCase,
IPv6HTTPDummyServerTestCase)
-from urllib3.poolmanager import PoolManager
-from urllib3.connectionpool import port_by_scheme
-from urllib3.exceptions import MaxRetryError, SSLError
-from urllib3.util.retry import Retry
+from urllib4.poolmanager import PoolManager
+from urllib4.connectionpool import port_by_scheme
+from urllib4.exceptions import MaxRetryError, SSLError
+from urllib4.util.retry import Retry
class TestPoolManager(HTTPDummyServerTestCase):
diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py
index df300fef..9cdf872b 100644
--- a/test/with_dummyserver/test_proxy_poolmanager.py
+++ b/test/with_dummyserver/test_proxy_poolmanager.py
@@ -9,10 +9,10 @@ from dummyserver.server import (
DEFAULT_CA, DEFAULT_CA_BAD, get_unreachable_address)
from .. import TARPIT_HOST
-from urllib3.poolmanager import proxy_from_url, ProxyManager
-from urllib3.exceptions import (
+from urllib4.poolmanager import proxy_from_url, ProxyManager
+from urllib4.exceptions import (
MaxRetryError, SSLError, ProxyError, ConnectTimeoutError)
-from urllib3.connectionpool import connection_from_url, VerifiedHTTPSConnection
+from urllib4.connectionpool import connection_from_url, VerifiedHTTPSConnection
class TestHTTPProxyManager(HTTPDummyProxyTestCase):
diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py
index db481d30..d1c264de 100644
--- a/test/with_dummyserver/test_socketlevel.py
+++ b/test/with_dummyserver/test_socketlevel.py
@@ -1,18 +1,18 @@
# TODO: Break this module up into pieces. Maybe group by functionality tested
# rather than the socket level-ness of it.
-from urllib3 import HTTPConnectionPool, HTTPSConnectionPool
-from urllib3.poolmanager import proxy_from_url
-from urllib3.exceptions import (
+from urllib4 import HTTPConnectionPool, HTTPSConnectionPool
+from urllib4.poolmanager import proxy_from_url
+from urllib4.exceptions import (
MaxRetryError,
ProxyError,
ReadTimeoutError,
SSLError,
ProtocolError,
)
-from urllib3.util.ssl_ import HAS_SNI
-from urllib3.util.timeout import Timeout
-from urllib3.util.retry import Retry
+from urllib4.util.ssl_ import HAS_SNI
+from urllib4.util.timeout import Timeout
+from urllib4.util.retry import Retry
from dummyserver.testcase import SocketDummyServerTestCase
from dummyserver.server import (
@@ -556,7 +556,7 @@ class TestSSL(SocketDummyServerTestCase):
pool.close()
self.assertRaises(SSLError, request)
- # Should not hang, see https://github.com/shazow/urllib3/issues/529
+ # Should not hang, see https://github.com/shazow/urllib4/issues/529
self.assertRaises(SSLError, request)
diff --git a/urllib3/__init__.py b/urllib3/__init__.py
index 8cd51444..010da22e 100644
--- a/urllib3/__init__.py
+++ b/urllib3/__init__.py
@@ -1,5 +1,5 @@
"""
-urllib3 - Thread-safe connection pooling and re-using.
+urllib4 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
@@ -42,7 +42,7 @@ def add_stderr_logger(level=logging.DEBUG):
Returns the handler after adding it.
"""
# This method needs to be in this __init__.py to get the __name__ correct
- # even if urllib3 is vendored within another package.
+ # even if urllib4 is vendored within another package.
logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
@@ -63,6 +63,6 @@ warnings.simplefilter('default', exceptions.InsecurePlatformWarning)
def disable_warnings(category=exceptions.HTTPWarning):
"""
- Helper for quickly disabling all urllib3 warnings.
+ Helper for quickly disabling all urllib4 warnings.
"""
warnings.simplefilter('ignore', category)
diff --git a/urllib3/connection.py b/urllib3/connection.py
index e5de769d..60676a45 100644
--- a/urllib3/connection.py
+++ b/urllib3/connection.py
@@ -68,7 +68,7 @@ class HTTPConnection(_HTTPConnection, object):
Additional keyword parameters are used to configure attributes of the connection.
Accepted parameters include:
- - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool`
+ - ``strict``: See the documentation on :class:`urllib4.connectionpool.HTTPConnectionPool`
- ``source_address``: Set the source address for the current connection.
.. note:: This is ignored for Python 2.6. It is only applied for 2.7 and 3.x
@@ -247,7 +247,7 @@ class VerifiedHTTPSConnection(HTTPSConnection):
warnings.warn((
'Certificate has no `subjectAltName`, falling back to check for a `commonName` for now. '
'This feature is being removed by major browsers and deprecated by RFC 2818. '
- '(See https://github.com/shazow/urllib3/issues/497 for details.)'),
+ '(See https://github.com/shazow/urllib4/issues/497 for details.)'),
SecurityWarning
)
match_hostname(cert, self.assert_hostname or hostname)
diff --git a/urllib3/connectionpool.py b/urllib3/connectionpool.py
index 0085345c..7916ec38 100644
--- a/urllib3/connectionpool.py
+++ b/urllib3/connectionpool.py
@@ -114,9 +114,9 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param timeout:
Socket timeout in seconds for each individual connection. This can
be a float or integer, which sets the timeout for the HTTP request,
- or an instance of :class:`urllib3.util.Timeout` which gives you more
+ or an instance of :class:`urllib4.util.Timeout` which gives you more
fine-grained control over request timeouts. After the constructor has
- been parsed, this is always a `urllib3.util.Timeout` object.
+ been parsed, this is always a `urllib4.util.Timeout` object.
:param maxsize:
Number of connections to save that can be reused. More than 1 is useful
@@ -140,15 +140,15 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param _proxy:
Parsed proxy URL, should not be used directly, instead, see
- :class:`urllib3.connectionpool.ProxyManager`"
+ :class:`urllib4.connectionpool.ProxyManager`"
:param _proxy_headers:
A dictionary with proxy headers, should not be used directly,
- instead, see :class:`urllib3.connectionpool.ProxyManager`"
+ instead, see :class:`urllib4.connectionpool.ProxyManager`"
:param \**conn_kw:
- Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`,
- :class:`urllib3.connection.HTTPSConnection` instances.
+ Additional parameters are used to create fresh :class:`urllib4.connection.HTTPConnection`,
+ :class:`urllib4.connection.HTTPSConnection` instances.
"""
scheme = 'http'
@@ -216,7 +216,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param timeout:
Seconds to wait before giving up and raising
- :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and
+ :class:`urllib4.exceptions.EmptyPoolError` if the pool is empty and
:prop:`.block` is ``True``.
"""
conn = None
@@ -286,7 +286,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
pass
def _get_timeout(self, timeout):
- """ Helper that always returns a :class:`urllib3.util.Timeout` """
+ """ Helper that always returns a :class:`urllib4.util.Timeout` """
if timeout is _Default:
return self.timeout.clone()
@@ -327,7 +327,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
Socket timeout in seconds for the request. This can be a
float or integer, which will set the same timeout value for
the socket connect and the socket read, or an instance of
- :class:`urllib3.util.Timeout`, which gives you more fine-grained
+ :class:`urllib4.util.Timeout`, which gives you more fine-grained
control over your timeouts.
"""
self.num_requests += 1
@@ -345,7 +345,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
raise
# conn.request() calls httplib.*.request, not the method in
- # urllib3.request. It also calls makefile (recv) on the socket.
+ # urllib4.request. It also calls makefile (recv) on the socket.
conn.request(method, url, **httplib_request_kw)
# Reset the timeout for the recv() on the socket
@@ -453,10 +453,10 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param retries:
Configure the number of retries to allow before raising a
- :class:`~urllib3.exceptions.MaxRetryError` exception.
+ :class:`~urllib4.exceptions.MaxRetryError` exception.
Pass ``None`` to retry until you receive a response. Pass a
- :class:`~urllib3.util.retry.Retry` object for fine-grained control
+ :class:`~urllib4.util.retry.Retry` object for fine-grained control
over different types of retries.
Pass an integer number to retry connection errors that many times,
but no other types of errors. Pass zero to never retry.
@@ -465,7 +465,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
immediately. Also, instead of raising a MaxRetryError on redirects,
the redirect response will be returned.
- :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
+ :type retries: :class:`~urllib4.util.retry.Retry`, False, or an int.
:param redirect:
If True, automatically handle redirects (status codes 301, 302,
@@ -480,7 +480,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param timeout:
If specified, overrides the default timeout for this one
request. It may be a float (in seconds) or an instance of
- :class:`urllib3.util.Timeout`.
+ :class:`urllib4.util.Timeout`.
:param pool_timeout:
If set and the pool is set to block=True, then this method will
@@ -499,7 +499,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
:param \**response_kw:
Additional parameters are passed to
- :meth:`urllib3.response.HTTPResponse.from_httplib`
+ :meth:`urllib4.response.HTTPResponse.from_httplib`
"""
if headers is None:
headers = self.headers
@@ -664,7 +664,7 @@ class HTTPSConnectionPool(HTTPConnectionPool):
The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs`` and
``ssl_version`` are only used if :mod:`ssl` is available and are fed into
- :meth:`urllib3.util.ssl_wrap_socket` to upgrade the connection socket
+ :meth:`urllib4.util.ssl_wrap_socket` to upgrade the connection socket
into an SSL socket.
"""
@@ -693,7 +693,7 @@ class HTTPSConnectionPool(HTTPConnectionPool):
def _prepare_conn(self, conn):
"""
- Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket`
+ Prepare the ``connection`` for :meth:`urllib4.util.ssl_wrap_socket`
and establish the tunnel if proxy is used.
"""
@@ -765,7 +765,7 @@ class HTTPSConnectionPool(HTTPConnectionPool):
warnings.warn((
'Unverified HTTPS request is being made. '
'Adding certificate verification is strongly advised. See: '
- 'https://urllib3.readthedocs.org/en/latest/security.html'),
+ 'https://urllib4.readthedocs.org/en/latest/security.html'),
InsecureRequestWarning)
diff --git a/urllib3/contrib/ntlmpool.py b/urllib3/contrib/ntlmpool.py
index c6b266f5..6ad22ea9 100644
--- a/urllib3/contrib/ntlmpool.py
+++ b/urllib3/contrib/ntlmpool.py
@@ -1,7 +1,7 @@
"""
NTLM authenticating pool, contributed by erikcederstran
-Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10
+Issue #10, see: http://code.google.com/p/urllib4/issues/detail?id=10
"""
try:
@@ -11,7 +11,7 @@ except ImportError:
from logging import getLogger
from ntlm import ntlm
-from urllib3 import HTTPSConnectionPool
+from urllib4 import HTTPSConnectionPool
log = getLogger(__name__)
@@ -19,7 +19,7 @@ log = getLogger(__name__)
class NTLMConnectionPool(HTTPSConnectionPool):
"""
- Implements an NTLM authentication version of an urllib3 connection pool
+ Implements an NTLM authentication version of an urllib4 connection pool
"""
scheme = 'https'
diff --git a/urllib3/contrib/pyopenssl.py b/urllib3/contrib/pyopenssl.py
index ee657fb3..8c6be63f 100644
--- a/urllib3/contrib/pyopenssl.py
+++ b/urllib3/contrib/pyopenssl.py
@@ -14,25 +14,25 @@ You can install them with the following command:
pip install pyopenssl ndg-httpsclient pyasn1
To activate certificate checking, call
-:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code
+:func:`~urllib4.contrib.pyopenssl.inject_into_urllib4` from your Python code
before you begin making HTTP requests. This can be done in a ``sitecustomize``
-module, or at any other time before your application begins using ``urllib3``,
+module, or at any other time before your application begins using ``urllib4``,
like this::
try:
- import urllib3.contrib.pyopenssl
- urllib3.contrib.pyopenssl.inject_into_urllib3()
+ import urllib4.contrib.pyopenssl
+ urllib4.contrib.pyopenssl.inject_into_urllib4()
except ImportError:
pass
-Now you can use :mod:`urllib3` as you normally would, and it will support SNI
+Now you can use :mod:`urllib4` as you normally would, and it will support SNI
when the required modules are installed.
Activating this module also has the positive side effect of disabling SSL/TLS
compression in Python 2 (see `CRIME attack`_).
If you want to configure the default list of supported cipher suites, you can
-set the ``urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST`` variable.
+set the ``urllib4.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST`` variable.
Module Variables
----------------
@@ -62,12 +62,12 @@ import select
from .. import connection
from .. import util
-__all__ = ['inject_into_urllib3', 'extract_from_urllib3']
+__all__ = ['inject_into_urllib4', 'extract_from_urllib4']
# SNI only *really* works if we can read the subjectAltName of certificates.
HAS_SNI = SUBJ_ALT_NAME_SUPPORT
-# Map from urllib3 to PyOpenSSL compatible parameter-values.
+# Map from urllib4 to PyOpenSSL compatible parameter-values.
_openssl_versions = {
ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD,
@@ -107,15 +107,15 @@ orig_util_HAS_SNI = util.HAS_SNI
orig_connection_ssl_wrap_socket = connection.ssl_wrap_socket
-def inject_into_urllib3():
- 'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.'
+def inject_into_urllib4():
+ 'Monkey-patch urllib4 with PyOpenSSL-backed SSL-support.'
connection.ssl_wrap_socket = ssl_wrap_socket
util.HAS_SNI = HAS_SNI
-def extract_from_urllib3():
- 'Undo monkey-patching by :func:`inject_into_urllib3`.'
+def extract_from_urllib4():
+ 'Undo monkey-patching by :func:`inject_into_urllib4`.'
connection.ssl_wrap_socket = orig_connection_ssl_wrap_socket
util.HAS_SNI = orig_util_HAS_SNI
diff --git a/urllib3/exceptions.py b/urllib3/exceptions.py
index 31bda1c0..a1ab680b 100644
--- a/urllib3/exceptions.py
+++ b/urllib3/exceptions.py
@@ -63,7 +63,7 @@ class MaxRetryError(RequestError):
"""Raised when the maximum number of retries is exceeded.
:param pool: The connection pool
- :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool`
+ :type pool: :class:`~urllib4.connectionpool.HTTPConnectionPool`
:param string url: The requested Url
:param exceptions.Exception reason: The underlying error
diff --git a/urllib3/fields.py b/urllib3/fields.py
index c853f8d5..9baad60e 100644
--- a/urllib3/fields.py
+++ b/urllib3/fields.py
@@ -70,9 +70,9 @@ class RequestField(object):
@classmethod
def from_tuples(cls, fieldname, value):
"""
- A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.
+ A :class:`~urllib4.fields.RequestField` factory from old-style tuple parameters.
- Supports constructing :class:`~urllib3.fields.RequestField` from
+ Supports constructing :class:`~urllib4.fields.RequestField` from
parameter of key/value strings AND key/filetuple. A filetuple is a
(filename, data, MIME type) tuple where the MIME type is optional.
For example::
diff --git a/urllib3/filepost.py b/urllib3/filepost.py
index 0fbf488d..00d01cfe 100644
--- a/urllib3/filepost.py
+++ b/urllib3/filepost.py
@@ -22,7 +22,7 @@ def iter_field_objects(fields):
Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
- :class:`~urllib3.fields.RequestField`.
+ :class:`~urllib4.fields.RequestField`.
"""
if isinstance(fields, dict):
@@ -43,9 +43,9 @@ def iter_fields(fields):
Iterate over fields.
- The addition of :class:`~urllib3.fields.RequestField` makes this function
+ The addition of :class:`~urllib4.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
- :class:`~urllib3.fields.RequestField` objects.
+ :class:`~urllib4.fields.RequestField` objects.
Supports list of (k, v) tuples and dicts.
"""
@@ -60,7 +60,7 @@ def encode_multipart_formdata(fields, boundary=None):
Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
:param fields:
- Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
+ Dictionary of fields or list of (key, :class:`~urllib4.fields.RequestField`).
:param boundary:
If not specified, then a random boundary will be generated using
diff --git a/urllib3/poolmanager.py b/urllib3/poolmanager.py
index b8d1e745..0fa5df2f 100644
--- a/urllib3/poolmanager.py
+++ b/urllib3/poolmanager.py
@@ -43,7 +43,7 @@ class PoolManager(RequestMethods):
:param \**connection_pool_kw:
Additional parameters are used to create fresh
- :class:`urllib3.connectionpool.ConnectionPool` instances.
+ :class:`urllib4.connectionpool.ConnectionPool` instances.
Example::
@@ -103,7 +103,7 @@ class PoolManager(RequestMethods):
Get a :class:`ConnectionPool` based on the host, port, and scheme.
If ``port`` isn't given, it will be derived from the ``scheme`` using
- ``urllib3.connectionpool.port_by_scheme``.
+ ``urllib4.connectionpool.port_by_scheme``.
"""
if not host:
@@ -128,9 +128,9 @@ class PoolManager(RequestMethods):
def connection_from_url(self, url):
"""
- Similar to :func:`urllib3.connectionpool.connection_from_url` but
+ Similar to :func:`urllib4.connectionpool.connection_from_url` but
doesn't pass any additional parameters to the
- :class:`urllib3.connectionpool.ConnectionPool` constructor.
+ :class:`urllib4.connectionpool.ConnectionPool` constructor.
Additional parameters are taken from the :class:`.PoolManager`
constructor.
@@ -140,12 +140,12 @@ class PoolManager(RequestMethods):
def urlopen(self, method, url, redirect=True, **kw):
"""
- Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen`
+ Same as :meth:`urllib4.connectionpool.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``.
The given ``url`` parameter must be absolute, such that an appropriate
- :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.
+ :class:`urllib4.connectionpool.ConnectionPool` can be chosen for it.
"""
u = parse_url(url)
conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
@@ -204,7 +204,7 @@ class ProxyManager(PoolManager):
authentication.
Example:
- >>> proxy = urllib3.ProxyManager('http://localhost:3128/')
+ >>> proxy = urllib4.ProxyManager('http://localhost:3128/')
>>> r1 = proxy.request('GET', 'http://google.com/')
>>> r2 = proxy.request('GET', 'http://httpbin.org/')
>>> len(proxy.pools)
diff --git a/urllib3/request.py b/urllib3/request.py
index b08d6c92..ceff3152 100644
--- a/urllib3/request.py
+++ b/urllib3/request.py
@@ -12,8 +12,8 @@ __all__ = ['RequestMethods']
class RequestMethods(object):
"""
Convenience mixin for classes who implement a :meth:`urlopen` method, such
- as :class:`~urllib3.connectionpool.HTTPConnectionPool` and
- :class:`~urllib3.poolmanager.PoolManager`.
+ as :class:`~urllib4.connectionpool.HTTPConnectionPool` and
+ :class:`~urllib4.poolmanager.PoolManager`.
Provides behavior for making common types of HTTP request methods and
decides which type of request field encoding to use.
@@ -88,7 +88,7 @@ class RequestMethods(object):
the body. This is useful for request methods like POST, PUT, PATCH, etc.
When ``encode_multipart=True`` (default), then
- :meth:`urllib3.filepost.encode_multipart_formdata` is used to encode
+ :meth:`urllib4.filepost.encode_multipart_formdata` is used to encode
the payload with the appropriate content type. Otherwise
:meth:`urllib.urlencode` is used with the
'application/x-www-form-urlencoded' content type.
diff --git a/urllib3/response.py b/urllib3/response.py
index 7e08fffe..1e9d1876 100644
--- a/urllib3/response.py
+++ b/urllib3/response.py
@@ -157,7 +157,7 @@ class HTTPResponse(io.IOBase):
@property
def data(self):
- # For backwords-compat with earlier urllib3 0.4 and earlier.
+ # For backwords-compat with earlier urllib4 0.4 and earlier.
if self._body:
return self._body
@@ -298,7 +298,7 @@ class HTTPResponse(io.IOBase):
def from_httplib(ResponseCls, r, **response_kw):
"""
Given an :class:`httplib.HTTPResponse` instance ``r``, return a
- corresponding :class:`urllib3.response.HTTPResponse` object.
+ corresponding :class:`urllib4.response.HTTPResponse` object.
Remaining parameters are passed to the HTTPResponse constructor, along
with ``original_response=r``.
diff --git a/urllib3/util/connection.py b/urllib3/util/connection.py
index 859aec6e..6de6897a 100644
--- a/urllib3/util/connection.py
+++ b/urllib3/util/connection.py
@@ -68,7 +68,7 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
sock = socket.socket(af, socktype, proto)
# If provided, set socket level options before connecting.
- # This is the only addition urllib3 makes to this function.
+ # This is the only addition urllib4 makes to this function.
_set_socket_options(sock, socket_options)
if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
diff --git a/urllib3/util/request.py b/urllib3/util/request.py
index bc64f6b1..0b60e862 100644
--- a/urllib3/util/request.py
+++ b/urllib3/util/request.py
@@ -21,7 +21,7 @@ def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
:param user_agent:
String representing the user-agent you want, such as
- "python-urllib3/0.6"
+ "python-urllib4/0.6"
:param basic_auth:
Colon-separated username:password string for 'authorization: basic ...'
diff --git a/urllib3/util/retry.py b/urllib3/util/retry.py
index 7e0959df..563db1fd 100644
--- a/urllib3/util/retry.py
+++ b/urllib3/util/retry.py
@@ -34,7 +34,7 @@ class Retry(object):
response = http.request('GET', 'http://example.com/', retries=False)
- Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless
+ Errors will be wrapped in :class:`~urllib4.exceptions.MaxRetryError` unless
retries are disabled, in which case the causing exception will be raised.
:param int total:
@@ -88,7 +88,7 @@ class Retry(object):
By default, this is disabled with ``None``.
:param float backoff_factor:
- A backoff factor to apply between attempts. urllib3 will sleep for::
+ A backoff factor to apply between attempts. urllib4 will sleep for::
{backoff factor} * (2 ^ ({number of total retries} - 1))
@@ -211,7 +211,7 @@ class Retry(object):
:param response: A response object, or None, if the server did not
return a response.
- :type response: :class:`~urllib3.response.HTTPResponse`
+ :type response: :class:`~urllib4.response.HTTPResponse`
:param Exception error: An error encountered during the request, or
None if the response was received successfully.
diff --git a/urllib3/util/ssl_.py b/urllib3/util/ssl_.py
index 8be221c0..364924a8 100644
--- a/urllib3/util/ssl_.py
+++ b/urllib3/util/ssl_.py
@@ -73,9 +73,9 @@ except ImportError:
def wrap_socket(self, socket, server_hostname=None):
warnings.warn(
'A true SSLContext object is not available. This prevents '
- 'urllib3 from configuring SSL appropriately and may cause '
+ 'urllib4 from configuring SSL appropriately and may cause '
'certain SSL connections to fail. For more information, see '
- 'https://urllib3.readthedocs.org/en/latest/security.html'
+ 'https://urllib4.readthedocs.org/en/latest/security.html'
'#insecureplatformwarning.',
InsecurePlatformWarning
)
@@ -168,7 +168,7 @@ def resolve_ssl_version(candidate):
return candidate
-def create_urllib3_context(ssl_version=None, cert_reqs=ssl.CERT_REQUIRED,
+def create_urllib4_context(ssl_version=None, cert_reqs=ssl.CERT_REQUIRED,
options=None, ciphers=None):
"""All arguments have the same meaning as ``ssl_wrap_socket``.
@@ -180,8 +180,8 @@ def create_urllib3_context(ssl_version=None, cert_reqs=ssl.CERT_REQUIRED,
If you wish to enable SSLv3, you can do::
- from urllib3.util import ssl_
- context = ssl_.create_urllib3_context()
+ from urllib4.util import ssl_
+ context = ssl_.create_urllib4_context()
context.options &= ~ssl_.OP_NO_SSLv3
You can do the same to enable compression (substituting ``COMPRESSION``
@@ -239,14 +239,14 @@ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
When SNI is supported, the expected hostname of the certificate
:param ssl_context:
A pre-made :class:`SSLContext` object. If none is provided, one will
- be created using :func:`create_urllib3_context`.
+ be created using :func:`create_urllib4_context`.
:param ciphers:
A string of ciphers we wish the client to support. This is not
supported on Python 2.6 as the ssl module does not support it.
"""
context = ssl_context
if context is None:
- context = create_urllib3_context(ssl_version, cert_reqs,
+ context = create_urllib4_context(ssl_version, cert_reqs,
ciphers=ciphers)
if ca_certs:
diff --git a/urllib3/util/timeout.py b/urllib3/util/timeout.py
index ea7027f3..515e4c7a 100644
--- a/urllib3/util/timeout.py
+++ b/urllib3/util/timeout.py
@@ -6,7 +6,7 @@ import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
-# urllib3
+# urllib4
_Default = object()
def current_time():
@@ -66,7 +66,7 @@ class Timeout(object):
.. note::
- Many factors can affect the total amount of time for urllib3 to return
+ Many factors can affect the total amount of time for urllib4 to return
an HTTP response.
For example, Python's DNS resolver does not obey the timeout specified
@@ -169,7 +169,7 @@ class Timeout(object):
def start_connect(self):
""" Start the timeout clock, used during a connect() attempt
- :raises urllib3.exceptions.TimeoutStateError: if you attempt
+ :raises urllib4.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already.
"""
if self._start_connect is not None:
@@ -182,7 +182,7 @@ class Timeout(object):
:return: Elapsed time.
:rtype: float
- :raises urllib3.exceptions.TimeoutStateError: if you attempt
+ :raises urllib4.exceptions.TimeoutStateError: if you attempt
to get duration for a timer that hasn't been started.
"""
if self._start_connect is None:
@@ -217,12 +217,12 @@ class Timeout(object):
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If the connection time has not been
- established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be
+ established, a :exc:`~urllib4.exceptions.TimeoutStateError` will be
raised.
:return: Value to use for the read timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
- :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect`
+ :raises urllib4.exceptions.TimeoutStateError: If :meth:`start_connect`
has not yet been called on this object.
"""
if (self.total is not None and