Skip to main content

Yet another unofficial Notion API client.

Project description

Nothion

Yet another unofficial Notion API client.

Installation

pip install nothion

Usage

from nothion import NotionClient

client = NotionClient(auth_secret="your_auth_token",
                      tasks_db_id: str | None = None,
                      stats_db_id: str | None = None,
                      notes_db_id: str | None = None,
                      expenses_db_id: str | None = None)
client.tasks.get_active_tasks()

Features

Tasks Handler

  • get_active_tasks()
  • get_task(ticktick_task: Task)
  • get_notion_id(ticktick_task: Task)
  • is_task_already_created(task: Task)
  • create(task: Task)
  • update_task(task: Task)
  • complete(task: Task)
  • delete(task: Task)

Notes Handler

  • is_page_already_created(title: str, page_type: str)
  • create_page(title: str, page_type: str, page_subtype: tuple[str], date: datetime, content: str)

Stats Handler

  • get_incomplete_dates(limit_date: datetime) -> List[str]
  • update(stat_data: PersonalStats, overwrite_stats: bool = False)
  • get_between_dates(start_date: datetime, end_date: datetime) -> List[PersonalStats]

Expenses Handler

  • add_expense_log(expense_log: ExpenseLog)

Blocks Handler

  • get_all_children(block_id: str) -> list

Data Models

PersonalStats

This package uses a custom attrs model to store personal stats:

  • date: str
  • focus_total_time: float | None
  • focus_active_time: float | None
  • work_time: float | None
  • leisure_time: float | None
  • sleep_time_amount: float | None
  • sleep_deep_amount: float | None
  • fall_asleep_time: float | None
  • sleep_score: float | None
  • weight: float | None
  • steps: float | None
  • water_cups: int | None

ExpenseLog

This package uses a custom attrs model to store expense log data:

  • date: str
  • expense: float
  • product: str

Environment Variables

  • NT_AUTH: Notion auth token, for example secret_t1Cd...

Project details


Download files

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

Source Distribution

nothion-0.4.7.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nothion-0.4.7-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file nothion-0.4.7.tar.gz.

File metadata

  • Download URL: nothion-0.4.7.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for nothion-0.4.7.tar.gz
Algorithm Hash digest
SHA256 61f823c7890232d3d7d90d1128f848e0633ae1217e06c13773a6799efdbcf433
MD5 4c6ad929b45210d36cf55c9cf304fb53
BLAKE2b-256 28d97e883cfb19b614d2e11fb2c45681cb8075040d8dec0dcc4cbf70d846d774

See more details on using hashes here.

File details

Details for the file nothion-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: nothion-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for nothion-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 21a5f2b1c175e9a34af99f65d6c57109312b4d9906383a6b0d2cf820d0bfe120
MD5 4a8f8a9c412b8f79e54d8aecdb2c1d2f
BLAKE2b-256 d40bc79d401c1cd3225d789fe261d9c65ac63a53ca4f7d8e0ca86761a497e991

See more details on using hashes here.

Supported by

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