File: //usr/local/lib/python3.7/site-packages/urllib3/__pycache__/_request_methods.cpython-37.pyc
B
���gL � @ s� d dl mZ d dlZd dlZd dlmZ ddlmZ ddl m
Z
ddlmZm
Z
ddlmZ d gZejejejeejeef f ejeejeef f f ZG d
d � d �ZdS )� )�annotationsN)� urlencode� )�
_TYPE_BODY)�HTTPHeaderDict)�_TYPE_FIELDS�encode_multipart_formdata)�BaseHTTPResponse�RequestMethodsc
@ s� e Zd ZdZddddhZd"ddd �d
d�Zd#d
d
ddddddd�dd�Zd$d
d
ddddddd�dd�Zd%d
d
ddd
dd�dd�Zd&d
d
ddddd
dd�d d!�Z dS )'r
a�
Convenience mixin for classes who implement a :meth:`urlopen` method, such
as :class:`urllib3.HTTPConnectionPool` and
:class:`urllib3.PoolManager`.
Provides behavior for making common types of HTTP request methods and
decides which type of request field encoding to use.
Specifically,
:meth:`.request_encode_url` is for sending requests whose fields are
encoded in the URL (such as GET, HEAD, DELETE).
:meth:`.request_encode_body` is for sending requests whose fields are
encoded in the *body* of the request using multipart or www-form-urlencoded
(such as for POST, PUT, PATCH).
:meth:`.request` is for making any kind of request, it will look up the
appropriate encoding format and use one of the above two methods to make
the request.
Initializer parameters:
:param headers:
Headers to include with all requests, unless other headers are given
explicitly.
�DELETE�GET�HEAD�OPTIONSNztyping.Mapping[str, str] | None�None)�headers�returnc C s |pi | _ d S )N)r )�selfr � r �B/usr/local/lib/python3.7/site-packages/urllib3/_request_methods.py�__init__3 s zRequestMethods.__init__T�strz_TYPE_BODY | None�boolz
str | Nonez
typing.Anyr )�method�url�bodyr �encode_multipart�multipart_boundary�kwr c K s t d��d S )NzMClasses extending RequestMethods must implement their own ``urlopen`` method.)�NotImplementedError)r r r r r r r r r r r �urlopen6 s
zRequestMethods.urlopenz_TYPE_FIELDS | Noneztyping.Any | None)r r r �fieldsr �json�
urlopen_kwr c K s� |� � }|dk r |dk r td��|dk rl|dkr:| j�� }dttj|�� �krVd|d<