Remove remaining mentions of Google App Engine
MODIFY
.coveragerc
.coveragerc
@@ -4,7 +4,6 @@ source =
omit =
*urllib3/packages/*
- *urllib3/contrib/appengine.py
*urllib3/contrib/ntlmpool.py
*urllib3/contrib/pyopenssl.py
*urllib3/contrib/securetransport.py

MODIFY
docs/advanced-usage.rst
docs/advanced-usage.rst
@@ -329,39 +329,6 @@ Finally, you can suppress the warnings at the interpreter level by setting the
``PYTHONWARNINGS`` environment variable or by using the
`-W flag <https://docs.python.org/3/using/cmdline.html#cmdoption-w>`_.
-Google App Engine
------------------
-
-urllib3 supports `Google App Engine <https://cloud.google.com/appengine>`_ with
-some caveats.
-
-If you're using the `Flexible environment
-<https://cloud.google.com/appengine/docs/flexible/>`_, you do not have to do
-any configuration- urllib3 will just work. However, if you're using the
-`Standard environment <https://cloud.google.com/appengine/docs/python/>`_ then
-you either have to use :mod:`urllib3.contrib.appengine`'s
-:class:`~urllib3.contrib.appengine.AppEngineManager` or use the `Sockets API
-<https://cloud.google.com/appengine/docs/python/sockets/>`_
-
-To use :class:`~urllib3.contrib.appengine.AppEngineManager`:
-
-.. code-block:: pycon
-
- >>> from urllib3.contrib.appengine import AppEngineManager
- >>> http = AppEngineManager()
- >>> http.request('GET', 'https://google.com/')
-
-To use the Sockets API, add the following to your app.yaml and use
-:class:`~urllib3.poolmanager.PoolManager` as usual:
-
-.. code-block:: yaml
-
- env_variables:
- GAE_USE_SOCKETS_HTTPLIB : 'true'
-
-For more details on the limitations and gotchas, see
-:mod:`urllib3.contrib.appengine`.
-
Brotli Encoding
---------------

MODIFY
dummyserver/handlers.py
dummyserver/handlers.py
@@ -4,7 +4,6 @@ import gzip
import json
import logging
import sys
-import time
import zlib
from datetime import datetime, timedelta
from http.client import responses
@@ -216,14 +215,6 @@ class TestingApp(RequestHandler):
)
return Response(repr(params))
- def sleep(self, request):
- "Sleep for a specified amount of ``seconds``"
- # DO NOT USE THIS, IT'S DEPRECATED.
- # FIXME: Delete this once appengine tests are fixed to not use this handler.
- seconds = float(request.params.get("seconds", "1"))
- time.sleep(seconds)
- return Response()
-
def echo(self, request):
"Echo back the params"
if request.method == "GET":

MODIFY
src/urllib3/connection.py
src/urllib3/connection.py
@@ -165,8 +165,7 @@ class HTTPConnection(_HTTPConnection):
return conn
def _is_using_tunnel(self):
- # Google App Engine's httplib does not define _tunnel_host
- return getattr(self, "_tunnel_host", None)
+ return self._tunnel_host
def _prepare_conn(self, conn):
self.sock = conn
@@ -290,10 +289,6 @@ class HTTPSConnection(HTTPConnection):
self.ssl_context = ssl_context
self.server_hostname = server_hostname
- # Required property for Google AppEngine 1.9.0 which otherwise causes
- # HTTPS requests to go out as HTTP. (See Issue #356)
- self._protocol = "https"
-
def set_cert(
self,
key_file=None,

MODIFY
src/urllib3/connectionpool.py
src/urllib3/connectionpool.py
@@ -409,8 +409,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
# Reset the timeout for the recv() on the socket
read_timeout = timeout_obj.read_timeout
- # App Engine doesn't have a sock attr
- if getattr(conn, "sock", None):
+ if conn.sock:
# In Python 3 socket.py will catch EAGAIN and return None when you
# try and read into the file pointer created by http.client, which
# instead raises a BadStatusLine exception. Instead of catching
@@ -443,8 +442,6 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
raise
- # AppEngine doesn't have a version attr.
- http_version = getattr(conn, "_http_vsn_str", "HTTP/?")
log.debug(
'%s://%s:%s "%s %s %s" %s %s',
self.scheme,
@@ -452,7 +449,8 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
self.port,
method,
url,
- http_version,
+ # HTTP version
+ conn._http_vsn_str,
httplib_response.status,
httplib_response.length,
)
@@ -1002,7 +1000,7 @@ class HTTPSConnectionPool(HTTPConnectionPool):
super()._validate_conn(conn)
# Force connect early to allow us to validate the connection.
- if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
+ if not conn.sock:
conn.connect()
if not conn.is_verified:

MODIFY
src/urllib3/util/connection.py
src/urllib3/util/connection.py
@@ -11,9 +11,6 @@ def is_connection_dropped(conn): # Platform-specific
:param conn:
:class:`http.client.HTTPConnection` object.
-
- Note: For platforms like AppEngine, this will always return ``False`` to
- let the platform handle connection recycling transparently for us.
"""
sock = getattr(conn, "sock", False)
if sock is None: # Connection already closed (such as by httplib).

MODIFY
src/urllib3/util/response.py
src/urllib3/util/response.py
@@ -92,7 +92,6 @@ def assert_header_parsing(headers):
def is_response_to_head(response):
"""
Checks whether the request of a response has been a HEAD-request.
- Handles the quirks of AppEngine.
:param http.client.HTTPResponse response:
Response to check if the originating request

Remove remaining mentions of Google App Engine