There are limitations to the URLFetch service and it may not be
the best choice for your application. There are three options for using
urllib3 on Google App Engine:

You can use AppEngineManager with URLFetch. URLFetch is
cost-effective in many circumstances as long as your usage is within the
limitations.

You can use a normal PoolManager by enabling sockets.
Sockets also have limitations and restrictions and have a lower free quota than URLFetch.
To use sockets, be sure to specify the following in your app.yaml:

env_variables:GAE_USE_SOCKETS_HTTPLIB:'true'

3. If you are using App Engine Flexible, you can use the standard
PoolManager without any configuration or special environment variables.

Configure the number of retries to allow before raising a
MaxRetryError exception.

Pass None to retry until you receive a response. Pass a
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.

If False, then retries are disabled and any exception is raised
immediately. Also, instead of raising a MaxRetryError on redirects,
the redirect response will be returned.

assert_same_host – If True, will make sure that the host of the pool requests is
consistent else will raise HostChangedError. When False, you can
use the pool on an HTTP proxy and request foreign hosts.

timeout – If specified, overrides the default timeout for this one
request. It may be a float (in seconds) or an instance of
urllib3.util.Timeout.

pool_timeout – If set and the pool is set to block=True, then this method will
block for pool_timeout seconds and raise EmptyPoolError if no
connection is available within the time period.

release_conn – If False, then the urlopen call will not release the connection
back into the pool once a response is received (but will release if
you read the entire contents of the response such as when
preload_content=True). This is useful if you’re not preloading
the response’s content immediately. You will need to call
r.release_conn() on the response r to return the connection
back into the pool. If None, it takes the value of
response_kw.get('preload_content',True).

chunked – If True, urllib3 will send the body using chunked transfer
encoding. Otherwise, urllib3 will send the body using the standard
content-length form. Defaults to False.

body_pos (int) – Position to seek to in file-like body in the event of a retry or
redirect. Typically this won’t need to be set because urllib3 will
auto-populate the value when needed.

SSL with SNI-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
not do certificate checking; you need to do additional work to validate
certificates yourself.

This needs the following packages installed:

pyOpenSSL (tested with 16.0.0)

cryptography (minimum 1.3.4, from pyopenssl)

idna (minimum 2.0, from cryptography)

However, pyopenssl depends on cryptography, which depends on idna, so while we
use all three directly here we end up having relatively few packages required.

You can install them with the following command:

pip install pyopenssl cryptography idna

To activate certificate checking, call
inject_into_urllib3() 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,
like this:

This module contains provisional support for SOCKS proxies from within
urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
SOCKS5. To enable its functionality, either install PySocks or install this
module with the socks extra.

The SOCKS implementation supports the full range of urllib3 features. It also
supports the following SOCKS features:

SOCKS4

SOCKS4a

SOCKS5

Usernames and passwords for the SOCKS proxy

Known Limitations:

Currently PySocks does not support contacting remote websites via literal
IPv6 addresses. Any such connection attempt will fail. You must use a domain
name.

Currently PySocks does not support IPv6 connections to the SOCKS proxy. Any
such connection attempt will fail.