{"id":19640197,"url":"https://github.com/gearplug/notion-python","last_synced_at":"2026-02-05T20:32:21.367Z","repository":{"id":142463678,"uuid":"611302263","full_name":"GearPlug/notion-python","owner":"GearPlug","description":"notion-python is an API wrapper for Notion, written in Python.","archived":false,"fork":false,"pushed_at":"2024-10-11T20:20:38.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-22T13:43:23.676Z","etag":null,"topics":["api","database","notion","oauth2","pages","project-management","python","queries","query","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GearPlug.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-08T14:47:37.000Z","updated_at":"2024-10-11T20:20:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"beaebf95-4f0b-4fd8-b18c-1ec952da4ea1","html_url":"https://github.com/GearPlug/notion-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GearPlug/notion-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Fnotion-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Fnotion-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Fnotion-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Fnotion-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GearPlug","download_url":"https://codeload.github.com/GearPlug/notion-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GearPlug%2Fnotion-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29133396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T19:36:52.185Z","status":"ssl_error","status_checked_at":"2026-02-05T19:35:40.941Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","database","notion","oauth2","pages","project-management","python","queries","query","wrapper"],"created_at":"2024-11-11T14:04:59.799Z","updated_at":"2026-02-05T20:32:21.351Z","avatar_url":"https://github.com/GearPlug.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# notion-python\n![](https://img.shields.io/badge/version-0.1.2-success) ![](https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11-4B8BBE?logo=python\u0026logoColor=white)\n  \n*notion-python* is an API wrapper for Notion, written in Python.  \nThis library uses Oauth2 for authentication.\n## Installing\n```\npip install notion-python-2\n```\n## Usage\n* If you don't have an access token:\n```\nfrom notion.client import Client\nclient = Client(client_id, client_secret, redirect_uri)\n```\nTo obtain and set an access token, follow this instructions:\n1. **Get authorization URL**\n```\nurl = client.authorization_url()\n```\n2. **Get access token using code**\n```\nresponse = client.get_access_token(code)\n```\n3. **Set access token**\n```\nclient.set_token(access_token)\n```  \nCheck more information about Notion Oauth: https://developers.notion.com/docs/authorization  \n\n* If you already have an access token:\n```\nfrom notion.client import Client\nclient = Client(access_token=access_token)\n```\n### User\n#### - Get Current User\n```\nuser = client.get_current_user()\n```\n#### - List users\n```\nusers = client.list_users(page_size=3)\n# page_size: max 100 \n# start_cursor: pagination variable, get this value from previous page 'next_cursor' parameter.\n```\n### Databases and Pages\n#### - List all objects\n```\n# object_type options are: page or database\n# page_size: max 100 \n# start_cursor: pagination variable, get this value from previous page 'next_cursor' parameter.\n\ndatabases_list = client.list_objects(\"database\", page_size=5)\n```\n#### - Get database\n```\ndatabase = client.get_database(database_id)\n```\n#### - Query database pages\nHow to build a filter object: https://developers.notion.com/reference/post-database-query-filter  \nHow to build a sort object: https://developers.notion.com/reference/post-database-query-sort\n```\nfilter_criteria = {\"property\": \"Main Email\", \"email\": {\"equals\": \"example@mail.com\"}}\n# Where 'Main Email' is the field name and 'email' is the field type\npages = client.query_database_pages(\n    database_id, \n    filters=filter_criteria, \n    sorts: dict = None, \n    start_cursor=None, \n    page_size=None\n)\n```\n#### - Create page\n```\nproperties_example = {\n    \"Project name\": {\n        \"title\": [\n            {\n                \"text\": {\n                    \"content\": \"First project built with this library\"\n                    }\n            }\n        ]\n    },\n}\ncover_url = \"https://upload.wikimedia.org/wikipedia/commons/1/1/example.jpg\"\npage = client.create_page(database_id, properties_example, cover_url=cover_url)\n```\n#### - Update page\n```\nproperties_example = {\n    \"Project name\": {\n        \"title\": [\n            {\n                \"text\": {\n                    \"content\": \"Project field modified\"\n                    }\n            }\n        ]\n    },\n}\npage = client.update_page(page_id, properties_example, cover_url=None)\n```\nHow to build a properties object: https://developers.notion.com/reference/page-property-values\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgearplug%2Fnotion-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgearplug%2Fnotion-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgearplug%2Fnotion-python/lists"}