Notion API Client
This is the python client for the Notion API. Use this client to report on ingredients, and create new ingredients.
Install
pip install notion-python
Usage
Get your API Token, and ingredient information from here: https://app.usenotion.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},
])
Error Handling
All methods will raise a subclass of notion.NotionError in the event that the request could not be made, or an error occurred.
Development
Install
git clone https://github.com/notion-data/notion-python.git
cd notion-python
pip install -e .
Tests
env NOTION_TOKEN=FOOBAR NOTION_API_ROOT=https://app.usenotion.com python -m unittest discover
pylint --output-format parseable --disable C0111 notion tests
Metadata
Release files for notion-python 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| notion_python-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for notion_python-1.0.1-py2.py3-none-any.whl |
Release files / notion_python-1.0.1-py2.py3-none-any.whl
| Download URL | notion_python-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
06946ad521c5448f57b2232f652fb1793b0fcb24c10904fcbd9516c64e451220
|
|
BLAKE2b-256 checksum How to use checksums |
6f8a06433b661c336dc56ba02ecb9e9847f5d9dcd936099eddeb8677783ff7a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for notion-python 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.