← Back
Editing: _compat.cpython-38.pyc
U �ˀX�$ � @ s d Z ddlmZmZ ddlZddlZz(ddlmZ ddlmZ ddlm Z W n8 e k r� ddlmZ ddlmZ ddlm Z Y nX zddlm Z ddlmZ W nN e k r� zddlm Z ddlmZ W n e k r� dZ dZY nX Y nX ejd k �rdZn4zdd lmZ W n" e k �r6 dd lmZ Y nX ejdk �rJdZn4zddlmZ W n" e k �r| ddlmZ Y nX ejd kZe�r�ddlZddlmZmZ n ddlZddlmZ ddl mZ ze!Z!W n e"k �r� e#e$fZ!Y nX G dd� de�Z%dZ&dS )z�Private module full of compatibility hacks. Primarily this is for downstream redistributions of requests that unvendor urllib3 without providing a shim. .. warning:: This module is private. If you use it, and something breaks, you were warned � )�Mapping�MutableMappingN)�fields)�filepost)�poolmanager)�HTTPConnection)� connectioni )�timeouti )� appengine)� r )� urlencode�urljoin)r )r c s� e Zd ZdZd-� fdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z esZej Z ejZe� Zdd� Zdd� Zefdd�Zdd� Zdd� Zdd� Zdd� ZeZeZeZdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Z e!d+d,� �Z"� Z#S ).�HTTPHeaderDictap :param headers: An iterable of field-value pairs. Must not contain multiple field names when compared case-insensitively. :param kwargs: Additional field-value pairs to pass in to ``dict.update``. A ``dict`` like container for storing HTTP Headers. Field names are stored and compared case-insensitively in compliance with RFC 7230. Iteration provides the first case-sensitive key seen for each case-insensitive pair. Using ``__setitem__`` syntax overwrites fields that compare equal case-insensitively in order to maintain ``dict``'s api. For fields that compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add`` in a loop. If multiple fields that are equal case-insensitively are passed to the constructor or ``.update``, the behavior is undefined and some will be lost. >>> headers = HTTPHeaderDict() >>> headers.add('Set-Cookie', 'foo=bar') >>> headers.add('set-cookie', 'baz=quxx') >>> headers['content-length'] = '7' >>> headers['SET-cookie'] 'foo=bar, baz=quxx' >>> headers['Content-Length'] '7' Nc sN t t| ��� i | _|d k r<t|t�r2| �|� n | �|� |rJ| �|� d S �N)�superr �__init__� _container� isinstance� _copy_from�extend)�self�headers�kwargs�� __class__� �;/usr/lib/python3/dist-packages/requests_toolbelt/_compat.pyr g s zHTTPHeaderDict.__init__c C s ||f| j |�� <