Skip to main content

API Client for Notion

Project description

Notion API Client

https://circleci.com/gh/notion-data/notion-python/tree/master.svg?style=shield

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

notion_python-1.0.1-py2.py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page