developer.autocomplete_metadata module
Script for membrane metadata autocomplete.
This script will try to fill further attributes in a
membrane metadata file based on the information
queried with the inchikey from:
- UniChem
- ChEMBL
- ChEBI
- PubChem
- CAS Common Chemistry (requires the CAS_API_KEY environment variable)
Note
This file is meant to be used by automated workflows.
Several upstream services (notably EBI’s UniChem and ChEBI) intermittently
answer with transient 5xx errors. Requests are therefore retried a few
times with exponential backoff that honors any Retry-After header, so a
blip does not abort metadata completion while staying polite to the servers.
The retry budget can be overridden with the AUTOCOMPLETE_MAX_RETRIES
environment variable (set it to 0 to disable retries entirely).
- developer.autocomplete_metadata.fetch(req, timeout=15)[source]
Open
req(a URL string orurllib.request.Request) robustly.Returns the response body as
bytesfor an HTTP 200 response, orNonewhen the resource is unavailable. Transient failures (HTTP 429/5xx and connection-level errors such as timeouts) are retried with backed-off,Retry-After-aware delays; definitive errors (e.g. 404) are not retried.