(self, header, *values)
Send a request header line to the server.

        For example: h.putheader('Accept', 'text/html')
Send a request header line to the server.
Send a request header line to the server .
def putheader(self, header, *values):
        """Send a request header line to the server.

        For example: h.putheader('Accept', 'text/html')
        """
        if self.__state != _CS_REQ_STARTED:
            raise CannotSendHeader()

        if hasattr(header, 'encode'):
            header = header.encode('ascii')

        if not _is_legal_header_name(header):
            raise ValueError('Invalid header name %r' % (header,))

        values = list(values)
        for i, one_value in enumerate(values):
            if hasattr(one_value, 'encode'):
                values[i] = one_value.encode('latin-1')
            elif isinstance(one_value, int):
                values[i] = str(one_value).encode('ascii')

            if _is_illegal_header_value(values[i]):
                raise ValueError('Invalid header value %r' % (values[i],))

        value = b'\r\n\t'.join(values)
        header = header + b': ' + value
        self._output(header)
def putheader ( self , header , * values ) : if self . __state != _CS_REQ_STARTED : raise CannotSendHeader ( ) if hasattr ( header , 'encode' ) : header = header . encode ( 'ascii' ) if not _is_legal_header_name ( header ) : raise ValueError ( 'Invalid header name %r' % ( header , ) ) values = list ( values ) for i , one_value in enumerate ( values ) : if hasattr ( one_value , 'encode' ) : values [ i ] = one_value . encode ( 'latin-1' ) elif isinstance ( one_value , int ) : values [ i ] = str ( one_value ) . encode ( 'ascii' ) if _is_illegal_header_value ( values [ i ] ) : raise ValueError ( 'Invalid header value %r' % ( values [ i ] , ) ) value = b'\r\n\t' . join ( values ) header = header + b': ' + value self . _output ( header )