Releases: scottbonline/sense
0.11.2 Optimize processing of websocket messages
What's Changed
Full Changelog: 0.11.1...0.11.2
0.11.1 Rate limit and Refresh Token Improvements
What's Changed
- Rate limit calls strictly based on time between calls to the API by @dennypage in #54
- The
update_realtime()
function will now automatically refresh the auth token if it has expired
Support for Refresh Tokens
Sense has updated their API to auto-expire auth tokens every 30 days as well as implementing refresh tokens to request a new auth token. This update adds support for refresh tokens and automatically renewing the auth token on auth failures.
Breaking Changes
The new refresh token will need to be stored and loaded. Any script that implements the load_auth
function must be updated. Instead of
sense.load_auth(access_token, user_id, monitor_id)
it should be called with
sense.load_auth(access_token, user_id, device_id, refresh_token)
sense.set_monitor_id(monitor_id)
New Functions
Added two new functions:
renew_auth()
- manually renew the auth token
logout()
- logout
Last Release for Python 2
This will be the last major release supporting Python 2
API requests returning 404 throw Authentication Error
Add 404 to api response that require authentication
Add exception for non-authentication errors in API call
Adds the new exception type SenseAPIException
for non-authentication errors in API calls
Status code check on api call
Adds a check that the API call was successful. Instead of just returning an empty dict if the call fails, an exception is raised
Add Load authentication Function
Along with the MFA update in the previous release, it's helpful to be able to save/load the authentication session info without re-authenticating. The load_auth(access_token, user_id, monitor_id)
provides this as an alternative to calling authenticate()
Add MFA Support
Added Support for authentication for users with MFA enabled. After the authenticate
function is called, a SenseMFARequiredException
will be raised at which point validate_mfa
function can be called with the MFA code
Standardize on UTC
Times are standardized with timezone data on UTC
The "HOUR" Trend was removed because it is not supported
Monitor timezone and Trend start date
Added support for the monitor timezone (text str) and the trend start date via the property .time_zone
and the function trend_start(scale)