Python Notion
A simple wrapper for Notion SDK written in Python
Installation
This library only supported Python version 3.7 and above, earlier version might be work, but it still has backward compatibility for current APIs
pip install pynotion-wrapper
Usage
Before to do that, ensure you've setup Notion Integration and obtain the Integration Token. You can see about the Integration in here.
For quick example to get all users :
from notion.clients import NotionAPI
version = "2021-05-13" # notion version is required
secret = "YOUR_NOTION_TOKEN"
client = NotionAPI(secret, version)
print(client.get_all_users())
That following result something like :
{'object': 'list', 'results': [{'object': 'user', 'id': 'd4da784c-1c77-47e8-96bd-e917d96cd8b8', 'name': 'Ryan Febriansyah', 'avatar_url': 'https://lh4.googleusercontent.com/-O3Rzxu0oM9k/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucnDB5M-7zjHQcTqlJ0JBiAtlA5-RQ/photo.jpg', 'type': 'person', 'person': {'email': 'ryanfebriansyah72@gmail.com'}}, {'object': 'user', 'id': 'f4eb6dff-b0a9-431e-993f-970f049f1c76', 'name': 'python-sdk', 'avatar_url': None, 'type': 'bot', 'bot': {}}], 'next_cursor': None, 'has_more': False}
This wrapper also providing dict representation, so it will be separate with JSON type and returned as List for relevant
object instances. For example, you can use this property method for retrieve all users information and db information :
from notion.clients import NotionAPI
version = "2021-05-13"
secret = "YOUR_NOTION_TOKEN"
client = NotionAPI(secret, version)
print(client.get_users_instances) # method for getting all user instances
print(client.get_db_instances) # method for getting all db instances
the returned value if using property method will be more simple rather than extensive output like in JSON based :
# encapsulated types
UserObjects(object='user', id='d4da784c-1c77-47e8-96bd-e917d96cd8b8', name='Ryan Febriansyah', type='person', email='ryanfebriansyah72@gmail.com')
Currently this wrapper only supported for retrieve Notion resources :
- Database
- Blocks
- Pages
- User
In the meantime, all APIs endpoint that provided by Notion will be adding into wrapper (for consideration itself, it might be delayed until Notion API already stable). All contributions are much welcomed!
Release files for pynotion-wrapper 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pynotion-wrapper-0.2.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pynotion_wrapper-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / pynotion-wrapper-0.2.1.tar.gz
| Download URL | pynotion-wrapper-0.2.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
200eea688de5355c5185f1780285205e499420fccc002ad423bd739127488cfa
|
|
BLAKE2b-256 checksum How to use checksums |
6fee4520c60422d547280bf59b78014450fdefb26edfd44cf17a3e3cc2f900be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|
Release files / pynotion_wrapper-0.2.1-py3-none-any.whl
| Download URL | pynotion_wrapper-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a13bbb9c0acae1da33ffff315a9b2ffe0068a6993a207bccb679da4e930a0b5
|
|
BLAKE2b-256 checksum How to use checksums |
393bb32b541004a5c395634173c3775123f26794a4bcf85b6dd10602ccc97d4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|