eegdash.http_api_client#
HTTP API client for EEGDash REST API.
Functions
|
Get an API client instance. |
Classes
|
HTTP client for EEGDash API. |
- class eegdash.http_api_client.EEGDashAPIClient(api_url: str | None = None, database: str = 'eegdash', auth_token: str | None = None)[source]
Bases:
objectHTTP client for EEGDash API.
- Parameters:
api_url (str, optional) – Base API URL. Default: https://data.eegdash.org
database (str, default "eegdash") – Database name (“eegdash”, “eegdash_staging”, or “eegdash_v1”).
auth_token (str, optional) – Auth token for admin write operations.
- find(query: dict[str, Any] | None = None, limit: int | None = None, skip: int | None = None, **kwargs) list[dict[str, Any]][source]
Query records. Auto-paginates if no limit specified.
- find_one(query: dict[str, Any] | None = None, **kwargs) dict[str, Any] | None[source]
Find a single record.
- get_dataset(dataset_id: str) dict[str, Any] | None[source]
Fetch a dataset document by ID.
- count_documents(query: dict[str, Any] | None = None, **kwargs) int[source]
Count documents matching query.
- insert_one(record: dict[str, Any]) str[source]
Insert single record (requires auth).
- insert_many(records: list[dict[str, Any]]) int[source]
Insert multiple records (requires auth).
- update_many(query: dict[str, Any], update: dict[str, Any]) tuple[int, int][source]
Update records matching query (requires auth).
- Parameters:
query (dict) – Filter query to match records.
update (dict) – Fields to set (wrapped in $set automatically).
- Return type:
tuple of (matched_count, modified_count)
- upsert_many(records: list[dict[str, Any]]) dict[str, int][source]
Upsert multiple records (requires auth).
New endpoint that uses bulk upsert based on dataset+bidspath.
- eegdash.http_api_client.get_client(api_url: str | None = None, database: str = 'eegdash', auth_token: str | None = None) EEGDashAPIClient[source]
Get an API client instance.