Skip to content

Client

client

bi_sdk.client.BlindInsightClient

BlindInsightClient(hostname, *, proxy=False, api_version=API_VERSION, debug=False, **kwargs)

A porcelain client wrapping the OpenAPI REST client for the BlindInsight HTTP API.

check_auth_credentials

check_auth_credentials()

Checks for the existence of auth credentials within API client.

check_connection

check_connection()

Checks that we can authenticate to the server with our credentials.

decrypt_data

decrypt_data(data, schema_url, **kwargs)

Return a list of dicts with the data decrypted.

Parameters:

Name Type Description Default
data list[dict]

The data to decrypt.

required
schema_url Optional[str]

The URL of the schema.

required

Returns:

Name Type Description
data list[dict]

The decrypted data.

ingest_data

ingest_data(data, schema_url, **kwargs)

Ingest data into the server.

See the documentation for resolve_schema_url for more information on kwargs that can be used if you don't have the schema_url directly.

Returns:

Name Type Description
data list[dict]

The ingested data.

login

login(username, password, print_func=print)

Logs into the server.

Parameters:

Name Type Description Default
username str

The username to use.

required
password str

The password to use.

required

Returns:

Name Type Description
success bool

Whether the login was successful.

proxy_decrypt_data

proxy_decrypt_data(schema_url, data)

Return a list of dicts with the data decrypted.

Parameters:

Name Type Description Default
schema_url str

The url of the schema.

required
data list[dict]

The data to decrypt.

required

Returns:

Name Type Description
data list[dict]

The decrypted data.

proxy_ingest_data

proxy_ingest_data(schema_url, data)

Ingest data into the server via the proxy.

Parameters:

Name Type Description Default
schema_url str

The name of the schema to use.

required
data list[dict]

The data to ingest.

required

Returns:

Name Type Description
data list[dict]

The ingested data.

proxy_search_data

proxy_search_data(schema_url, filters)

Search for a record in the server.

Parameters:

Name Type Description Default
schema_url str

The name of the schema to use.

required
filters list[dict]

The filters to apply.

required

Returns:

Name Type Description
data list[dict]

The search results.

resolve_schema_url

resolve_schema_url(org_slug, org_id, dataset_slug, dataset_id, schema_slug, schema_url)

Resolve the schema URL from the given arguments.

If schema_url is given, it will be used directly.

If dataset_id is given, it will be used with schema_slug to resolve the schema.

If org_id is given, it will be used with dataset_slug to resolve the dataset.

If org_slug is given, it will be used to resolve the organization.

For fastest ingestion use schema_url, otherwise additional API call overhead will be incurred.

Parameters:

Name Type Description Default
schema_url Optional[str]

The url of the schema to use.

required
org_slug Optional[str]

The slug of the organization to use.

required
org_id Optional[str]

The id of the organization to use.

required
dataset_slug Optional[str]

The slug of the dataset to use.

required
dataset_id Optional[str]

The id of the dataset to use.

required
schema_slug Optional[str]

The slug of the schema to use.

required

Returns:

Name Type Description
schema_url str

The resolved schema URL.

search_data

search_data(filters, schema_url, **kwargs)

Search for a record in the server.

Parameters:

Name Type Description Default
filters list[dict]

The filters to apply.

required
schema_url Optional[str]

The name of the schema to use.

required

Returns:

Name Type Description
data list[dict]

The search results.

set_debug

set_debug()

Enable debug logging if debug is passed.

bi_sdk.client.ClientError

Bases: RuntimeError

Raised when the BlindInsightClient encounters an error unrelated to the API.