Offers an API to retrieve data from the Braincube platform
Project description
Braincube API for Python
This connector allow a braincube user to access his data.
Pre requisites
The connector is supported for python 3+
Installation
pip install braincube-connector
Running the connector
First run
The first time the connector is launch, it will retrieve an oauth2 access token.
You will need to
- log in to your braincube, and go to "User" > Configure > Applications
- Add an application (set a name as you wish and
https://localhost:5000/token
as the redirect url) - Clic on the newly created application and copy the
Client ID
andClient Secret
fields - Run the connector
from braincube import connector as co
braincube_connector = co.get_data_collector()
- You will be asked to fill a config file with the
Client ID
andClient Secret
from above - Re-run the connector (you need to accept the browser security exception as we running on a self-signed ssl certificate)
Connector usage
The connector comes in 2 versions:
- A raw version return plain python objects
- A Panda version return pandas dataframes
import datetime
from braincube import connector as co
# Retrieve a connector
braincube_connector = co.get_data_collector() # by defaut the panda connector is used
braincube_connector_raw = co.get_data_collector(format_type="raw") # allow to get the raw connector
# Get the braincube list
braincube_connector.get_braincube_list()
# Get a braincube object
my_braincube = braincube_connector.get_braincube("my_braincube_name")
# Get the memory base list
my_braincube.get_memorybase_list()
# or
braincube_connector("my_braincube_name").get_memorybase_list()
# Get a memory base object
my_memory_base = my_braincube.get_memorybase("my_memory_base_id")
# Return the id of the variable which is used to order the memorybase (not necessarily the memory base reference)
my_memory_base.get_memorybase_order_variable()
# Return a list of variable id and names
my_memory_base.get_variable_list()
# Retrieve datas from all variables of the memorybase since 1 jan 2012
# Specifiying the starting date is mandatory if no ending date is specified datetime.now() is used
my_memory_base.retrieve_all_variables_from_memory_base(datetime.date(2012,1,1))
# To retrieve only some variable since 1 jan 2012
my_memory_base.retrieve_data([var_id1, var_id2], datetime.date(2012,1,1))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
braincube-connector-1.0.3.tar.gz
(29.1 kB
view hashes)
Built Distribution
Close
Hashes for braincube-connector-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b38f5d52b161cc25914caab725d8fd0221c6dc6afafd4928533471ae9dfc5296 |
|
MD5 | a90c40ce342a29a58cfe4ddcaa81e03a |
|
BLAKE2b-256 | 488bc5ac1e9d32ff1390ccc7c51ac57808d50d8544181683e0d92178f6a0c53d |
Close
Hashes for braincube_connector-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eda7afacc0c6ce4be31c4b5b769af0d50a35092b25df02eec3c5028e111c0498 |
|
MD5 | 78b0485e70f40d2d298939d65efe805e |
|
BLAKE2b-256 | 06d6af6f21626f381304429b5e25e95e86ada4e339ab2311daf34ffebdffe451 |