API Client for Notion
Project description
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
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file notion_python-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: notion_python-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06946ad521c5448f57b2232f652fb1793b0fcb24c10904fcbd9516c64e451220
|
|
| MD5 |
77793fca909f5c344ff6b3cca38ab8e8
|
|
| BLAKE2b-256 |
6f8a06433b661c336dc56ba02ecb9e9847f5d9dcd936099eddeb8677783ff7a9
|