Return headers, given user-specified key-word args.
170605
def get_hdrs(flds_all, **kws):
    """"""
    # Return Headers if the user explicitly lists them.
    hdrs = kws.get('hdrs', None)
    if hdrs is not None:
        return hdrs
    # User may specify a subset of fields or a column order using prt_flds
    if 'prt_flds' in kws:
        return kws['prt_flds']
    # All fields in the namedtuple will be in the headers
    return flds_all
319138
def args_as_tuple(self):
        """"""
        if "," in self.arguments["header-names"]:
            result = tuple(tools.to_list(self.arguments["header-names"]))
        else:
            result = (self.arguments["header-names"].strip('"'),)
        result = result + (self.arguments["match-type"],)
        if "," in self.arguments["key-list"]:
            result = result + tuple(
                tools.to_list(self.arguments["key-list"], unquote=False))
        else:
            result = result + (self.arguments["key-list"].strip('"'),)
        return result
1342667
def get_keyword(self, kwd, *args):
        """"""
        try:
            kwds = self.get_header()
            return kwds[kwd]
        except KeyError:
            # return a default if there is one
            if len(args) > 0:
                return args[0]
            raise KeyError(kwd)
185668
def parse_headers_link(headers):
    """"""

    header = CaseInsensitiveDict(headers).get('link')

    l = {}

    if header:
        links = parse_link(header)

        for link in links:
            key = link.get('rel') or link.get('url')
            l[key] = link

    return l
929459
def _post_keywords(self, **kwargs):
        """"""
        if self.jurisdiction and 'jurisdiction_id' not in kwargs:
            kwargs['jurisdiction_id'] = self.jurisdiction
        if 'address' in kwargs:
            address = kwargs.pop('address')
            kwargs['address_string'] = address
        if 'name' in kwargs:
            first, last = kwargs.pop('name').split(' ')
            kwargs['first_name'] = first
            kwargs['last_name'] = last
        if 'api_key' not in kwargs:
            kwargs['api_key'] = self.api_key
        return kwargs
367062
def _http_headers(self):
        
        if not self.usertag:
            return {}

        creds = u'{}:{}'.format(
            self.usertag,
            self.password or ''
        )
        token = base64.b64encode(creds.encode())
        return {
            'Authorization': 'Basic {}'.format(token.decode())
        }
537331
def parse_headers(self, req, name, field):
        """"""
        # Use req.get_headers rather than req.headers for performance
        return req.get_header(name, required=False) or core.missing
1282495
def with_headers(self, headers):
        
        for key, value in headers.items():
            self.with_header(key, value)
        return self
434999
def _head(self, client_kwargs):
        
        with _handle_oss_error():
            bucket = self._get_bucket(client_kwargs)

            # Object
            if 'key' in client_kwargs:
                return bucket.head_object(
                    key=client_kwargs['key']).headers

            # Bucket
            return bucket.get_bucket_info().headers
1242899
def kwargs(self):
        
        keywords = self.keywords or []
        return [keyword for keyword in keywords if keyword.arg is None]
409322
def _get_headers(self):
        """"""
        headers = {
            'user-agent': 'IPinfoClient/Python{version}/1.0'.format(version=sys.version_info[0]),
            'accept': 'application/json'
        }

        if self.access_token:
            headers['authorization'] = 'Bearer {}'.format(self.access_token)

        return headers
1128164
def get_kwargs(self):
        """"""
        return {k: v for k, v in vars(self).items() if k not in self._ignored}
675451
def get_headers(data, extra_headers=None):
    '''
    
    '''
    response_headers = {
        'Content-Length': str(len(data)),
    }

    if extra_headers:
        response_headers.update(extra_headers)

    return list(response_headers.items())
137773
def parse_headers(self, req, name, field):
        """"""
        return get_value(req.headers, name, field)
229981
def system_headers(input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/system/headers', input_params, always_retry=always_retry, **kwargs)
428994
def iteritems(self):
        """"""
        for n,v in self.msgobj.__dict__["_headers"]:
            yield n.lower(), v
        return
105169
def fromkeys(cls, seq, v=None):
        """"""

        return super(HeaderDict, cls).fromkeys(cls,
                                               [s.title() for s in seq], v)