rhino_health.lib.rhino_session#

Module Contents#

Classes#

RhinoSession

Allows access to various endpoints directly from the RhinoSession

class rhino_health.lib.rhino_session.RhinoSession(username: str, password: str, otp_code: Optional[str] = None, rhino_api_url: str = ApiEnvironment.PROD_API_URL, sdk_version: str = SDKVersion.PREVIEW)#

Bases: rhino_health.lib.rhino_client.RhinoClient

Allows access to various endpoints directly from the RhinoSession

Examples

>>> session.project.get_projects()
array[Project...]
>>> session.cohort.get_cohort(my_cohort_id)
Cohort
Attributes
project: Access endpoints at the project level
cohort: Access endpoints at the cohort level
dataschema: Access endpoints at the schema level
switch_user(self, username, password, otp_code=None)#

Switch the currently logged in user.

Parameters
username: str

The new email you are logging in with

password: str

The new password you are logging in with

otp_code: Optional[str]

2FA login code if 2FA is enabled for the account

get(self, url: str, params: Optional[dict] = None, adapter_kwargs: Optional[dict] = None)#

Low level interface for submitting a REST GET request.

Parameters
url: str

The URL that you are hitting

params: Optional[dict]

A dictionary of query params to send with the request

adapter_kwargs: Optional[dict]
(Advanced) a dictionary of additional kwargs to pass to the system
• accepted_status_codes List[int]: List of status codes to accept
• data_as_json bool: Pass the data attribute as a json to requests
Returns
api_response: APIResponse

Result of making the HTTP GET request

Examples

>>> session.get("/alpha/secret/api").raw_response.json()
{ "status": "success" }
post(self, url: str, data: Optional[rhino_health.lib.rest_handler.RequestDataType] = None, params: Optional[dict] = None, adapter_kwargs: dict = None)#

Low level interface for submitting a REST POST request.

Parameters
url: str

The URL that you are hitting

data: Union[str, dict, list]

The payload to include with the POST request

params: Optional[dict]

A dictionary of query params to send with the request

adapter_kwargs: Optional[dict]
(Advanced) a dictionary of additional kwargs to pass to the system
• accepted_status_codes List[int]: List of status codes to accept
• data_as_json bool: Pass the data attribute as a json to requests
Returns
api_response: APIResponse

Result of making the HTTP Post request

Examples

>>> session.post(
...   "/alpha/secret/api",
...   {"arbitrary_payload": "value"}
... ).raw_response.json()
{ "status": "success" }