def to_web(graph: BELGraph,
           host: Optional[str] = None,
           user: Optional[str] = None,
           password: Optional[str] = None,
           public: bool = False,
           ) -> requests.Response:
    """Send a graph to the receiver service and returns the :mod:`requests` response object.

    :param graph: A BEL graph
    :param host: The location of the BEL Commons server. Alternatively, looks up in PyBEL config with
     ``PYBEL_REMOTE_HOST`` or the environment as ``PYBEL_REMOTE_HOST`` Defaults to
     :data:`pybel.constants.DEFAULT_SERVICE_URL`
    :param user: Username for BEL Commons. Alternatively, looks up in PyBEL config with
     ``PYBEL_REMOTE_USER`` or the environment as ``PYBEL_REMOTE_USER``
    :param password: Password for BEL Commons. Alternatively, looks up in PyBEL config with
     ``PYBEL_REMOTE_PASSWORD`` or the environment as ``PYBEL_REMOTE_PASSWORD``
    :return: The response object from :mod:`requests`
    """
    if host is None:
        host = _get_host()
        log.debug('using host: %s', host)

    if user is None:
        user = _get_user()

        if user is None:
            raise ValueError('no user found')

    if password is None:
        password = _get_password()

        if password is None:
            raise ValueError('no password found')

    url = host.rstrip('/') + RECIEVE_ENDPOINT

    response = requests.post(
        url,
        json=to_json(graph),
        headers={
            'content-type': 'application/json',
            'User-Agent': 'PyBEL v{}'.format(get_version()),
            'bel-commons-public': 'true' if public else 'false',
        },
        auth=(user, password),
    )
    log.debug('received response: %s', response)

    return response
def to_web ( graph : BELGraph , host : Optional [ str ] = None , user : Optional [ str ] = None , password : Optional [ str ] = None , public : bool = False , ) -> requests . Response : if host is None : host = _get_host ( ) log . debug ( 'using host: %s' , host ) if user is None : user = _get_user ( ) if user is None : raise ValueError ( 'no user found' ) if password is None : password = _get_password ( ) if password is None : raise ValueError ( 'no password found' ) url = host . rstrip ( '/' ) + RECIEVE_ENDPOINT response = requests . post ( url , json = to_json ( graph ) , headers = { 'content-type' : 'application/json' , 'User-Agent' : 'PyBEL v{}' . format ( get_version ( ) ) , 'bel-commons-public' : 'true' if public else 'false' , } , auth = ( user , password ) , ) log . debug ( 'received response: %s' , response ) return response
Send a graph to the receiver service and returns the :mod:`requests` response object.

    :param graph: A BEL graph
    :param host: The location of the BEL Commons server. Alternatively, looks up in PyBEL config with
     ``PYBEL_REMOTE_HOST`` or the environment as ``PYBEL_REMOTE_HOST`` Defaults to
     :data:`pybel.constants.DEFAULT_SERVICE_URL`
    :param user: Username for BEL Commons. Alternatively, looks up in PyBEL config with
     ``PYBEL_REMOTE_USER`` or the environment as ``PYBEL_REMOTE_USER``
    :param password: Password for BEL Commons. Alternatively, looks up in PyBEL config with
     ``PYBEL_REMOTE_PASSWORD`` or the environment as ``PYBEL_REMOTE_PASSWORD``
    :return: The response object from :mod:`requests`