This is the python client for the Notion API. Use this client to report on ingredients, and create new ingredients.
pip install notion-python
Get your API Token, and ingredient information from here: https://analyze.jamacloud.com/api_control_panel
import notion
# create a client
client = notion.NotionClient('YOUR_API_KEY')
# make a report
client.report(datetime.now(), 20, ingredient_id='AN_INGREDIENT_KEY')
# make many reports
client.batch_report('AN_INGREDIENT_KEY', [
{'date': datetime.now() - timedelta(days=1), 'value': 2},
{'date': datetime.now(), 'value': 3},
])
# create a new ingredient
client.create_ingredient('Ingredient Name', [
{'date': datetime.now() - timedelta(days=1), 'value': 2},
{'date': datetime.now(), 'value': 3},
])
All methods will raise a subclass of notion.NotionError
in the event that
the request could not be made, or an error occurred.
git clone https://github.com/notion-data/notion-python.git
cd notion-python
pip install -e .
env NOTION_TOKEN=FOOBAR NOTION_API_ROOT=https://analyze.jamacloud.com python -m unittest discover
pylint --output-format parseable --disable C0111 notion tests