chemistry_tools.pubchem.pug_rest
Attention
This package has the following additional requirements:
cawdrey>=0.1.7 mathematical>=0.1.13 pillow>=7.0.0 pyparsing>=2.4.6 tabulate>=0.8.9
These can be installed as follows:
python -m pip install chemistry-tools[pubchem]
Functions for interacting with PubChem PUG_REST API.
Functions:
|
Request wrapper that automatically handles asynchronous requests. |
|
Responsible for performing the actual GET request. |
|
Returns the full JSON record for the compound with the given ID. |
|
Construct API request from parameters and return the response. |
-
async_get(identifier, namespace='cid', operation=None, output='JSON', searchtype=None, **kwargs)[source] Request wrapper that automatically handles asynchronous requests.
- Parameters
identifier (
Union[str,int,Sequence[str]]) – Identifiers (e.g. name, CID) for the compounds to look up. When using the CID namespace data for multiple compounds can be retrieved at once by supplying either a comma-separated string or a list.namespace (
Union[PubChemNamespace,str]) – The type of identifier to look up. Valid values are inPubChemNamespace. Default'cid'.output (
str) – Default'JSON'.**kwargs – Keyword parameters passed along with the GET request.
- Return type
-
do_rest_get(namespace, identifier, format_=<PubChemFormats.JSON: 'JSON'>, domain=None, record_type='2d', png_width=300, png_height=300)[source] Responsible for performing the actual GET request.
- Parameters
namespace (
Union[PubChemNamespace,str]) – The type of identifier to look up. Valid values are inPubChemNamespace.identifier (
Union[str,int,Sequence[Union[str,int]]]) – Identifiers (e.g. name, CID) for the compounds to look up. When using the CID namespace data for multiple compounds can be retrieved at once by supplying either a comma-separated string or a list.format_ (
Union[PubChemFormats,str]) – The file format to retrieve the data in. Valid values are inPubChemFormats, plus'PNG'. Default<PubChemFormats.JSON: 'JSON'>.record_type (
str) – Default'2d'.png_width (
int) – Default300.png_height (
int) – Default300.
- Return type
-
request(identifier, namespace='cid', operation=None, output='JSON', searchtype=None, **kwargs)[source] Construct API request from parameters and return the response.
Full specification at http://pubchem.ncbi.nlm.nih.gov/pug_rest/PUG_REST.html
- Parameters
identifier (
Union[str,int,Sequence[str]]) – Identifiers (e.g. name, CID) for the compounds to look up. When using the CID namespace data for multiple compounds can be retrieved at once by supplying either a comma-separated string or a list.namespace (
Union[PubChemNamespace,str]) – The type of identifier to look up. Valid values are inPubChemNamespace. Default'cid'.output (
Union[PubChemFormats,str]) – Default'JSON'.**kwargs – Keyword parameters passed along with the GET request.
- Return type