nrgpy.cloud_api.auth module#
- class nrgpy.cloud_api.auth.CloudApi(client_id: str = '', client_secret: str = '', url_base: str = 'https://cloud-api.nrgsystems.com/nrgcloudcustomerapi/')[source]#
Bases:
object
Parent class for NRG Cloud API functionality
nrgpy simplifies usage of the NRG Cloud APIs. See the documentation for the cloud_api.sites, .export, and .convert modules for more information.
For non-nrgpy implementations, the following Usage information may be helpful.
The base url for the NRG Cloud APIs is
https://cloud-api.nrgsystems.com/nrgcloudcustomerapi/
Use client ID and secret to obtain a bearer token at the /token endpoint. This token is good for 24 hours.
You will be limited to creating 10 tokens per day, though normally one token should suffice, so please cache. nrgpy’s cloud_api modules will automatically manage bearer tokens, refreshing only when necessary.
Endpoints:
- /token
for accessing bearer token. Client ID and Secret required.
- /sites
Get list of sites. Bearer token required
- /convert
Convert RLD file to TXT. Bearer token required
- /export
Export TXT or RLD files for a given date range. NEC files may be used to format TXT outputs. Bearer token required.
- request_session_token() None [source]#
Generates a new session token for convert service api
Requires an active account with NRG Cloud. To sign up for a free account, go to:
Client ID and Secret can be accessed here:
https://cloud.nrgsystems.com/data-manager/api-setup
- Parameters:
- client_idstr
obtained from NRG Systems
- client_secretstr
- Returns:
- session_tokenstr
valid for 24 hour
- session_start_timedatetime
start time of 24 hour countdown