bestlab_platform.hobo

class bestlab_platform.hobo.HoboAPI(client_id, client_secret, user_id, endpoint='https://webservice.hobolink.com')[source]

Bases: object

HOBO API

Example

hobo_api = HoboAPI(client_id, client_secret, user_id) hobo_api.get_data([“1234567”, “8912345”], start_date_time, end_date_time)

__init__(client_id, client_secret, user_id, endpoint='https://webservice.hobolink.com')[source]
get_data(loggers, start_date_time, end_date_time, warn_on_empty_data=False)[source]

Get data from HOBO Web Services

Parameters
  • loggers (List[Union[str, int]] | Union[str, int]) – A list of Device IDs, or a single comma separated string of device ids.

  • start_date_time (str) – Must be in yyyy-MM-dd HH:mm:ss format

  • end_date_time (str) – Must be in yyyy-MM-dd HH:mm:ss format

  • warn_on_empty_data (bool) – If True, print a warning message (to HoboLogger, which by default is your console). Has no effect on function return.

Returns

JSON decoded response

Return type

response (dict)

Raises

TypeError – The “loggers” parameter type is incorrect

get(path, params=None)[source]

Http Get.

Requests the server to return specified resources.

Parameters
  • path (str) – api path

  • params (map) – request parameter

Returns

JSON decoded response body

Return type

response (dict)

post(path, body=None)[source]

Http Post.

Requests the server to update specified resources.

Parameters
  • path (str) – api path

  • body (map) – request body

Returns

JSON decoded response body

Return type

response (dict)

class bestlab_platform.hobo.HoboTokenInfo(token_response)[source]

Bases: object

Hobo token info.

access_token

Access token.

token_type

“bearer”.

expire_time

Time in seconds when the token will be expired.

Init HoboTokenInfo.

__init__(token_response)[source]

Init HoboTokenInfo.

need_refresh()[source]

Should we get a new the token?

Return type

bool