Skip to main content

Notion API Client

https://circleci.com/gh/notion-data/notion-python/tree/master.svg?style=shield https://img.shields.io/pypi/v/notion-python.svg

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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for notion-python 1.0.2
File Interpreter ABI Platform
notion_python-1.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / notion_python-1.0.2-py2.py3-none-any.whl

Download URL notion_python-1.0.2-py2.py3-none-any.whl
Size 7.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1de15b3a1bbcc4abdf3b2d173e22ae29f63d8ce5157decba7597d6c8b435c5ca
BLAKE2b-256 checksum
How to use checksums
693af20eea4eac7df383371c73ed96561000139fd3e22bb73d31551e882feb56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page