httk.serve.optimade.client¶
Synchronous, read-only discovery for remote OPTIMADE services.
This module establishes lossless schema snapshots and strict definition-IRI
recognition. Query construction and paginated execution live in
remote_query and are imported lazily by OptimadeStore.searcher().
Attributes¶
Exceptions¶
Base class for safe, client-side OPTIMADE failures. |
|
Report that the HTTP client could not complete a request. |
|
Report a non-success HTTP status from a remote endpoint. |
|
Report a non-success response with a parseable OPTIMADE error document. |
|
Report a malformed or inconsistent |
|
Report failure to negotiate a supported OPTIMADE API version. |
Classes¶
Describe one immutable remote entry endpoint discovered from |
|
Connect synchronously to a read-only OPTIMADE service and discover it eagerly. |
Module Contents¶
- exception httk.serve.optimade.client.OptimadeClientError[source]¶
Bases:
RuntimeErrorBase class for safe, client-side OPTIMADE failures.
- exception httk.serve.optimade.client.OptimadeTransportError(source_url, detail)[source]¶
Bases:
OptimadeClientErrorReport that the HTTP client could not complete a request.
- Parameters:
- exception httk.serve.optimade.client.OptimadeHTTPError(source_url, status_code, detail=None)[source]¶
Bases:
OptimadeClientErrorReport a non-success HTTP status from a remote endpoint.
- Parameters:
- exception httk.serve.optimade.client.OptimadeErrorDocumentError(source_url, status_code, detail=None)[source]¶
Bases:
OptimadeHTTPErrorReport a non-success response with a parseable OPTIMADE error document.
- exception httk.serve.optimade.client.OptimadeDiscoveryError(source_url, detail)[source]¶
Bases:
OptimadeClientErrorReport a malformed or inconsistent
/infodiscovery document.- Parameters:
- exception httk.serve.optimade.client.OptimadeVersionNegotiationError(source_url, detail)[source]¶
Bases:
OptimadeClientErrorReport failure to negotiate a supported OPTIMADE API version.
- Parameters:
- class httk.serve.optimade.client.RemoteEntryType[source]¶
Describe one immutable remote entry endpoint discovered from
/info.nameis solely the service’s transport endpoint name. Semantic recognition is intentionally represented bybindingand is derived exclusively from definition IRIs.- Parameters:
name – Transport endpoint name.
definition_id – Entry-definition IRI, when advertised.
schema – Lossless schema snapshot from discovery.
property_iris – Transport property names keyed by definition IRI.
property_names – Local property names keyed by definition IRI.
property_types – Property kinds keyed by transport name.
advertised_properties – Properties advertised by the service.
default_response_properties – Properties returned by default.
sortable_properties – Properties accepted by remote sorting.
binding – Recognized semantic binding, when available.
backend – Backend class associated with the binding.
- property_iris: collections.abc.Mapping[str, str][source]¶
- property_names: collections.abc.Mapping[str, str][source]¶
- class httk.serve.optimade.client.OptimadeStore(base_url, *, client=None, page_limit=50, max_pages=10000, allow_cross_origin_pagination=False, response_fields=None)[source]¶
Connect synchronously to a read-only OPTIMADE service and discover it eagerly.
Unversioned bases negotiate strictly through the preference-ordered
/versionsCSV. Query pagination validates complete pages before yielding, uses lazy one-root exact-literal requests, and bounds continuation links by page count and origin.- Parameters:
base_url (str) – Absolute HTTP(S) service base URL.
client (object | None) – Optional borrowed synchronous HTTP client.
page_limit (int) – Default remote page size.
max_pages (int) – Maximum continuation pages followed by one query.
allow_cross_origin_pagination (bool) – Permit continuation links on another origin.
response_fields (object | None) – Default response-field selection for new searchers.
- Raises:
OptimadeVersionNegotiationError – If the service cannot select a supported version.
OptimadeDiscoveryError – If discovery documents are malformed.
- property entry_types: tuple[RemoteEntryType, Ellipsis][source]¶
Discovered entry endpoints in the service-advertised order.
- property entry_types_by_name: collections.abc.Mapping[str, RemoteEntryType][source]¶
An immutable transport-name lookup for
entry_types.
- entry_type(name)[source]¶
Return one discovered endpoint by transport name.
- refresh()[source]¶
Refresh discovery state after a fully successful rediscovery.
- Raises:
OptimadeClientError – If the store is closed or discovery fails.
- searcher(*, response_fields=..., as_of=None)[source]¶
Create one synchronous, read-only remote search plan.
Passing
response_fieldsoverrides the store-level selection. An omitted value inherits it, while explicitNonerequests the service default.- Parameters:
- Returns:
New remote search plan.
- Raises:
OptimadeClientError – If the store is closed.
ValueError – If a historic cutoff is requested.
- Return type: