src/pybel/io/bel_commons_client.py
def to_bel_commons(
    graph: BELGraph,
    host: Optional[str] = None,
    user: Optional[str] = None,
    password: Optional[str] = None,
    public: bool = True,
) -> 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``.
    :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``
    :param public: Should the network be made public?
    :return: The response object from :mod:`requests`
    """
    if host is None:
        host = _get_host()
        logger.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_nodelink(graph),
        headers={
            'content-type': 'application/json',
            'User-Agent': 'PyBEL v{}'.format(get_version()),
            'bel-commons-public': 'true' if public else 'false',
        },
        auth=(user, password),
    )
    logger.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``.
    :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``
    :param public: Should the network be made public?
    :return: The response object from :mod:`requests`
    
Send a graph to the receiver service and returns the :mod:`requests` response object.
Send a graph to the receiver service and returns the : mod : ` requests ` response object .
def to_bel_commons(
    graph: BELGraph,
    host: Optional[str] = None,
    user: Optional[str] = None,
    password: Optional[str] = None,
    public: bool = True,
) -> requests.Response:
    if host is None:
        host = _get_host()
        logger.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_nodelink(graph),
        headers={
            'content-type': 'application/json',
            'User-Agent': 'PyBEL v{}'.format(get_version()),
            'bel-commons-public': 'true' if public else 'false',
        },
        auth=(user, password),
    )
    logger.debug('received response: %s', response)
    return response
def to_bel_commons ( graph : BELGraph , host : Optional [ str ] = None , user : Optional [ str ] = None , password : Optional [ str ] = None , public : bool = True , ) -> requests . Response : if host is None : host = _get_host ( ) logger . 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_nodelink ( graph ) , headers = { 'content-type' : 'application/json' , 'User-Agent' : 'PyBEL v{}' . format ( get_version ( ) ) , 'bel-commons-public' : 'true' if public else 'false' , } , auth = ( user , password ) , ) logger . debug ( 'received response: %s' , response ) return response
Send a graph to the receiver service and returns the :mod:`requests` response object.
Send a graph to the receiver service and returns the : mod : ` requests ` response object .
"""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``.
    :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``
    :param public: Should the network be made public?
    :return: The response object from :mod:`requests`
    """
The response object from :mod:`requests`
The response object from : mod : ` requests `
graph
BELGraph
A BEL graph
A BEL graph
host
Optional[str]
The location of the BEL Commons server. Alternatively, looks up in PyBEL config with
``PYBEL_REMOTE_HOST`` or the environment as ``PYBEL_REMOTE_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 ` ` .
user
Optional[str]
Username for BEL Commons. Alternatively, looks up in PyBEL config with
``PYBEL_REMOTE_USER`` or the environment as ``PYBEL_REMOTE_USER``
Username for BEL Commons . Alternatively looks up in PyBEL config with ` ` PYBEL_REMOTE_USER ` ` or the environment as ` ` PYBEL_REMOTE_USER ` `
password
Optional[str]
Password for BEL Commons. Alternatively, looks up in PyBEL config with
``PYBEL_REMOTE_PASSWORD`` or the environment as ``PYBEL_REMOTE_PASSWORD``
Password for BEL Commons . Alternatively looks up in PyBEL config with ` ` PYBEL_REMOTE_PASSWORD ` ` or the environment as ` ` PYBEL_REMOTE_PASSWORD ` `
public
bool
None