mkt.databases.oncokb.OncoKB
- class mkt.databases.oncokb.OncoKB(url: str = 'https://www.oncokb.org/api/v1', header: dict = <factory>)[source]
Bases:
APIKeyRESTAPIClient,ABCOncoKB API client.
- __init__(url: str = 'https://www.oncokb.org/api/v1', header: dict = <factory>) None
Methods
__eq__(other)Return self==value.
__init__([url, header])__post_init__()Initialize the OncoKB API client.
_stamp_from_response(res)Record query datetime + cache provenance from a requests-cache response.
_stamp_now()Record current UTC datetime; cache provenance unknown.
check_response(res)Check the response status code for errors.
extract_level_as_int(str_in)Extract the level from a string and convert it to an integer.
has_json()Get the JSON response from the OncoKB API query.
Get API token, if available.
Query the OncoKB API for a given URL.
set_api_key()Set API token for REST API.
Attributes
__dataclass_fields____dataclass_params____match_args___jsonfrom_cacheWhether the most recent response was served from requests-cache.
query_datetimeUTC datetime the underlying network query was made (cache creation time if served from cache).
Base URL for the OncoKB API.
URL to update for specific queries.
OncoKB API token, if available.
- __init__(url: str = 'https://www.oncokb.org/api/v1', header: dict = <factory>) None
- static extract_level_as_int(str_in: str | None) int | None[source]
Extract the level from a string and convert it to an integer.
- Parameters:
str_in (str | None) – String containing the level information
- Returns:
Level as integer if found, otherwise None
- Return type:
int | None
- has_json() dict | None[source]
Get the JSON response from the OncoKB API query.
- Returns:
JSON response if available, otherwise None
- Return type:
dict | None
- header: dict
OncoKB API token, if available.
- maybe_get_token() str | None[source]
Get API token, if available.
- Returns:
API token if available; None otherwise
- Return type:
str | None
- url: str = 'https://www.oncokb.org/api/v1'
Base URL for the OncoKB API.
- url_query: str | None = None
URL to update for specific queries.