netdata
Public Member Functions | Static Public Attributes | List of all members
python_modules.urllib3._collections.HTTPHeaderDict Class Reference
Inheritance diagram for python_modules.urllib3._collections.HTTPHeaderDict:

Public Member Functions

def __init__ (self, headers=None, kwargs)
 
def __setitem__ (self, key, val)
 
def __getitem__ (self, key)
 
def __delitem__ (self, key)
 
def __contains__ (self, key)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __len__ (self)
 
def __iter__ (self)
 
def pop (self, key, default=__marker)
 
def discard (self, key)
 
def add (self, key, val)
 
def extend (self, args, kwargs)
 
def getlist (self, key)
 
def __repr__ (self)
 
def copy (self)
 
def iteritems (self)
 
def itermerged (self)
 
def items (self)
 
def from_httplib (cls, message)
 

Static Public Attributes

 iterkeys
 
 itervalues
 
 getheaders
 
 getallmatchingheaders
 
 iget
 

Detailed Description

: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'

Member Function Documentation

§ add()

def python_modules.urllib3._collections.HTTPHeaderDict.add (   self,
  key,
  val 
)
Adds a (name, value) pair, doesn't overwrite the value if it already
exists.

>>> headers = HTTPHeaderDict(foo='bar')
>>> headers.add('Foo', 'baz')
>>> headers['foo']
'bar, baz'

§ extend()

def python_modules.urllib3._collections.HTTPHeaderDict.extend (   self,
  args,
  kwargs 
)
Generic import function for any type of header-like object.
Adapted version of MutableMapping.update in order to insert items
with self.add instead of self.__setitem__

§ from_httplib()

def python_modules.urllib3._collections.HTTPHeaderDict.from_httplib (   cls,
  message 
)
Read headers from a Python 2 httplib message object.

§ getlist()

def python_modules.urllib3._collections.HTTPHeaderDict.getlist (   self,
  key 
)
Returns a list of all the values for the named field. Returns an
empty list if the key doesn't exist.

§ iteritems()

def python_modules.urllib3._collections.HTTPHeaderDict.iteritems (   self)
Iterate over all header lines, including duplicate ones.

§ itermerged()

def python_modules.urllib3._collections.HTTPHeaderDict.itermerged (   self)
Iterate over all headers, merging duplicate ones together.

§ pop()

def python_modules.urllib3._collections.HTTPHeaderDict.pop (   self,
  key,
  default = __marker 
)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
  If key is not found, d is returned if given, otherwise KeyError is raised.

The documentation for this class was generated from the following file: