chemistry_tools.pubchem.errors

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]

Error handling.

Exceptions:

BadRequestError([msg])

Request is improperly formed (syntax error in the URL, POST body, etc.).

HTTPTimeoutError([msg])

The request timed out, from server overload or too broad a request.

MethodNotAllowedError([msg])

Request not allowed (such as invalid MIME type in the HTTP Accept header).

NotFoundError([msg])

The input record was not found (e.g.

PubChemHTTPError(e)

Generic error class to handle all HTTP error codes.

ResponseParseError

PubChem response is uninterpretable.

ServerError([msg])

Some problem on the server side (such as a database server down, etc.).

TimeoutError

alias of chemistry_tools.pubchem.errors.HTTPTimeoutError

UnimplementedError([msg])

The requested operation has not (yet) been implemented by the server.

Data:

HTTP_ERROR_CODES

Numerical list of HTTP status codes considered to be errors.

exception BadRequestError(msg='Request is improperly formed')[source]

Bases: chemistry_tools.pubchem.errors.PubChemHTTPError

Request is improperly formed (syntax error in the URL, POST body, etc.).

exception HTTPTimeoutError(msg='The request timed out')[source]

Bases: chemistry_tools.pubchem.errors.PubChemHTTPError

The request timed out, from server overload or too broad a request.

Changed in version 0.4.0: Renamed from TimeoutErrpr

HTTP_ERROR_CODES = [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 421, 422, 423, 424, 425, 426, 428, 429, 431, 451, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511]

Type:    list

Numerical list of HTTP status codes considered to be errors.

exception MethodNotAllowedError(msg='Request not allowed')[source]

Bases: chemistry_tools.pubchem.errors.PubChemHTTPError

Request not allowed (such as invalid MIME type in the HTTP Accept header).

exception NotFoundError(msg='The input record was not found')[source]

Bases: chemistry_tools.pubchem.errors.PubChemHTTPError

The input record was not found (e.g. invalid CID).

exception PubChemHTTPError(e)[source]

Bases: Exception

Generic error class to handle all HTTP error codes.

__str__()[source]

Return str(self).

Return type

str

exception ResponseParseError[source]

Bases: Exception

PubChem response is uninterpretable.

exception ServerError(msg='Some problem on the server side')[source]

Bases: chemistry_tools.pubchem.errors.PubChemHTTPError

Some problem on the server side (such as a database server down, etc.).

TimeoutError

alias of chemistry_tools.pubchem.errors.HTTPTimeoutError

exception UnimplementedError(msg='The requested operation has not been implemented')[source]

Bases: chemistry_tools.pubchem.errors.PubChemHTTPError

The requested operation has not (yet) been implemented by the server.