def post_to_server(post_data, config, auth=None):
    content_type, body = encode_multipart(post_data.items(), [])

    # build the Request
    headers = {
        'Content-type': content_type,
        'Content-length': str(len(body))
    }
    req = Request(config.repository, body, headers)

    # handle HTTP and include the Basic Auth handler
    opener = build_opener(HTTPBasicAuthHandler(password_mgr=auth))
    try:
        opener.open(req)
    except HTTPError:
        e = extract_exception()
        code, msg = e.code, e.msg
    except URLError:
        e = extract_exception()
        code, msg = 500, str(e)
    else:
        code, msg = 200, 'OK'

    return code, msg
Send the given post_data to the pypi server.
dataset/ETHPy150Open cournape/Bento/bento/pypi/register_utils.py/post_to_server