(host, selector, fields, files, username, password)
return content.decode('utf-8')
Post fields and files to an http host as multipart/form-data.
    fields is a sequence of (name, value) elements for regular form fields.
    files is a sequence of (name, filename, value) elements for data to be uploaded as files
    Return the server's response page.
Post fields and files to an http host as multipart/form-data.
    fields is a sequence of (name, value) elements for regular form fields.
    files is a sequence of (name, filename, value) elements for data to be uploaded as files
    Return the server's response page.
Post fields and files to an http host as multipart / form - data . fields is a sequence of ( name value ) elements for regular form fields . files is a sequence of ( name filename value ) elements for data to be uploaded as files Return the server s response page .
def post_multipart(host, selector, fields, files, username, password):
    """
    Post fields and files to an http host as multipart/form-data.
    fields is a sequence of (name, value) elements for regular form fields.
    files is a sequence of (name, filename, value) elements for data to be uploaded as files
    Return the server's response page.
    """
    base64string = base64.encodestring(bytes('%s:%s' % (username, password), 'ascii'))[:-1].decode('ascii')
    content_type, body = encode_multipart_formdata(fields, files)
    h = httplib2.Http(timeout=timeout)
    headers = { 'Authorization': 'Basic %s' % base64string,
                'Content-Type': content_type,
                'Content-Length': str(len(body)),
                'Cookie': str(cookie) }

    host = httpize(host)
    response, content = make_request(h, host + selector, method='POST', body=body, headers=headers)

    if response['status'] == '200' and 'set-cookie' in response:
        cookie.update(response['set-cookie'])
    elif response['status'] != '200':
        raise HTTPError(response['status'])

    return content.decode('utf-8')
def post_multipart ( host , selector , fields , files , username , password ) : base64string = base64 . encodestring ( bytes ( '%s:%s' % ( username , password ) , 'ascii' ) ) [ : - 1 ] . decode ( 'ascii' ) content_type , body = encode_multipart_formdata ( fields , files ) h = httplib2 . Http ( timeout = timeout ) headers = { 'Authorization' : 'Basic %s' % base64string , 'Content-Type' : content_type , 'Content-Length' : str ( len ( body ) ) , 'Cookie' : str ( cookie ) } host = httpize ( host ) response , content = make_request ( h , host + selector , method = 'POST' , body = body , headers = headers ) if response [ 'status' ] == '200' and 'set-cookie' in response : cookie . update ( response [ 'set-cookie' ] ) elif response [ 'status' ] != '200' : raise HTTPError ( response [ 'status' ] ) return content . decode ( 'utf-8' )