src/pybel/io/bel_commons_client.py
def from_bel_commons(network_id: int, host: Optional[str] = None) -> BELGraph:
    """Retrieve a public network from BEL Commons.

    In the future, this function may be extended to support authentication.

    :param network_id: The BEL Commons network identifier
    :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``.
    :raises: ValueError if host configuration can not be found
    """
    if host is None:
        host = _get_host()
    if host is None:
        raise ValueError('host not specified in arguments, PyBEL configuration, or environment.')

    url = host + GET_ENDPOINT.format(network_id)
    res = requests.get(url)
    graph_json = res.json()
    graph = from_nodelink(graph_json)
    return graph
Retrieve a public network from BEL Commons.

    In the future, this function may be extended to support authentication.

    :param network_id: The BEL Commons network identifier
    :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``.
    :raises: ValueError if host configuration can not be found
    
Retrieve a public network from BEL Commons.
In the future, this function may be extended to support authentication.
Retrieve a public network from BEL Commons . In the future this function may be extended to support authentication .
def from_bel_commons(network_id: int, host: Optional[str] = None) -> BELGraph:
    if host is None:
        host = _get_host()
    if host is None:
        raise ValueError('host not specified in arguments, PyBEL configuration, or environment.')
    url = host + GET_ENDPOINT.format(network_id)
    res = requests.get(url)
    graph_json = res.json()
    graph = from_nodelink(graph_json)
    return graph
def from_bel_commons ( network_id : int , host : Optional [ str ] = None ) -> BELGraph : if host is None : host = _get_host ( ) if host is None : raise ValueError ( 'host not specified in arguments, PyBEL configuration, or environment.' ) url = host + GET_ENDPOINT . format ( network_id ) res = requests . get ( url ) graph_json = res . json ( ) graph = from_nodelink ( graph_json ) return graph
Retrieve a public network from BEL Commons.
Retrieve a public network from BEL Commons .
"""Retrieve a public network from BEL Commons.

    In the future, this function may be extended to support authentication.

    :param network_id: The BEL Commons network identifier
    :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``.
    :raises: ValueError if host configuration can not be found
    """
ValueError if host configuration can not be found
ValueError if host configuration can not be found
network_id
int
The BEL Commons network identifier
The BEL Commons network identifier
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 ` ` .