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:
|
Request is improperly formed (syntax error in the URL, POST body, etc.). |
|
The request timed out, from server overload or too broad a request. |
|
Request not allowed (such as invalid MIME type in the HTTP Accept header). |
|
The input record was not found (e.g. |
Generic error class to handle all HTTP error codes. |
|
PubChem response is uninterpretable. |
|
|
Some problem on the server side (such as a database server down, etc.). |
|
The requested operation has not (yet) been implemented by the server. |
Data:
Numerical list of HTTP status codes considered to be errors. |
-
exception
BadRequestError(msg='Request is improperly formed')[source] Bases:
chemistry_tools.pubchem.errors.PubChemHTTPErrorRequest is improperly formed (syntax error in the URL, POST body, etc.).
- Parameters
msg (
str) – The error message. Default'Request is improperly formed'.
-
exception
HTTPTimeoutError(msg='The request timed out')[source] Bases:
chemistry_tools.pubchem.errors.PubChemHTTPErrorThe request timed out, from server overload or too broad a request.
Changed in version 0.4.0: Renamed from TimeoutErrpr
- Parameters
msg (
str) – The error message. Default'The request timed out'.
-
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:
listNumerical list of HTTP status codes considered to be errors.
-
exception
MethodNotAllowedError(msg='Request not allowed')[source] Bases:
chemistry_tools.pubchem.errors.PubChemHTTPErrorRequest not allowed (such as invalid MIME type in the HTTP Accept header).
- Parameters
msg (
str) – The error message. Default'Request not allowed'.
-
exception
NotFoundError(msg='The input record was not found')[source] Bases:
chemistry_tools.pubchem.errors.PubChemHTTPErrorThe input record was not found (e.g. invalid CID).
- Parameters
msg (
str) – The error message. Default'The input record was not found'.
-
exception
PubChemHTTPError(e)[source] Bases:
ExceptionGeneric error class to handle all HTTP error codes.
- Parameters
e (
Response) – The error fromrequests.
-
exception
ServerError(msg='Some problem on the server side')[source] Bases:
chemistry_tools.pubchem.errors.PubChemHTTPErrorSome problem on the server side (such as a database server down, etc.).
- Parameters
msg (
str) – The error message. Default'Some problem on the server side'.
-
TimeoutError
-
exception
UnimplementedError(msg='The requested operation has not been implemented')[source] Bases:
chemistry_tools.pubchem.errors.PubChemHTTPErrorThe requested operation has not (yet) been implemented by the server.
- Parameters
msg (
str) – The error message. Default'The requested operation has not been implemented'.