-
Notifications
You must be signed in to change notification settings - Fork 3
Project setup and productivity
A starter template is provided to make starting projects with the Bb_rest_helper library as easy and painless as possible. The template is here and provides the basic functionality to:
- Import the required classes.
- Set logging.
- Get configuration info from configuration file. (refer to documentation on config files)
- Authenticate and return the token and URL (for convenience)
#imports.
from Bb_rest_helper import Bb_Utils
from Bb_rest_helper import Get_Config
from Bb_rest_helper import Auth_Helper
from Bb_rest_helper import Bb_Requests
#logging and utils initialization.
utils = Bb_Utils()
utils.set_logging()
#Authenticate and get the token (Learn).
quick_auth_learn = utils.quick_auth('./credentials/config.json')
#Retrieve token and server url
learn_token = quick_auth_learn['token']
learn_url = quick_auth_learn['url']
print(learn_token,learn_url)
#Initialize Rest API calls
reqs = Bb_Requests()
#Your code goes here
Additionally, the exact same code as above is provided in a Jupyter notebook. These are great for research and testing as it is easy to break down the functionality in code cells that can run independently
To use the notebook, in addition to the configuration explained in the documentation, it is necessary to install Jypyter. Also, I would recommend to check out the Jupyter extension for VS studio code.
#make sure that your virtual environment is active
Pip3 install Jupyter
For more advanced users, the repository template here allows to quickly create a Github repository with a project blueprint (including base documentation). This template repository includes.
- Credentials folder with credentials template, you only need to fill in the information from your server, key and secret
- LICENSE.md, feel free to change to the license you want to use.
- README.md, with base documentation to be used as a starter
- app.py as the main application file that imports helper classed and where the main functionality will be coded
- gitignore to avoid configuration, env and other files to be uploaded to a public/private repository. Make sure to change the name to **".gitignore" in your local folder so it becomes active
- requirements.txt to install dependencies
- research.ipnyb Jupyter notebook with starter code for testing and research
- script_helper to add all helper clases for the project that can be imported and called from app.py. by default contains a Helper class that already initialises the Bb_rest_helper
Bb-REST-HELPER V.3 documentation