3 �P\t � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z ddlm Z G d d � d ej�ZG dd� deej�Z G d d� de �ZG dd� de�ZG dd� de�Zddd�Zdd� ZdS )a The App Engine Transport Adapter for requests. .. versionadded:: 0.6.0 This requires a version of requests >= 2.10.0 and Python 2. There are two ways to use this library: #. If you're using requests directly, you can use code like: .. code-block:: python >>> import requests >>> import ssl >>> import requests.packages.urllib3.contrib.appengine as ul_appengine >>> from requests_toolbelt.adapters import appengine >>> s = requests.Session() >>> if ul_appengine.is_appengine_sandbox(): ... s.mount('http://', appengine.AppEngineAdapter()) ... s.mount('https://', appengine.AppEngineAdapter()) #. If you depend on external libraries which use requests, you can use code like: .. code-block:: python >>> from requests_toolbelt.adapters import appengine >>> appengine.monkeypatch() which will ensure all requests.Session objects use AppEngineAdapter properly. You are also able to :ref:`disable certificate validation <insecure_appengine>` when monkey-patching. � N)�adapters)�sessions� )� exceptions)� gaecontrib)�timeoutc s$ e Zd ZdZdZ� fdd�Z� ZS )�AppEngineMROHacka� Resolves infinite recursion when monkeypatching. This works by injecting itself as the base class of both the :class:`AppEngineAdapter` and Requests' default HTTPAdapter, which needs to be done because default HTTPAdapter's MRO is recompiled when we monkeypatch, at which point this class becomes HTTPAdapter's base class. In addition, we use an instantiation flag to avoid infinite recursion. Fc s"