altvod / basic-notion Goto Github PK
View Code? Open in Web Editor NEWClient-agnostic model wrapper for Notion API
License: MIT License
Client-agnostic model wrapper for Notion API
License: MIT License
how to fix it?
i tried to put page to the table with to do blocks
from notion_client import Client
from basic_notion.query import Query
from basic_notion.page import NotionPage, NotionPageList
from basic_notion.block import NotionBlock, ToDoBlock, TextListField
from basic_notion.field import SelectField, TitleField, MultiSelectField, UrlField
class PageBlock(NotionBlock):
to_do = ToDoBlock()
class MyRow(NotionPage):
name = TitleField(property_name='Задача | Проект')
doing = SelectField(property_name='Выполнение')
tags = MultiSelectField(property_name='Tags')
link = UrlField(property_name='Ссылка')
class MyData(NotionPageList[MyRow]):
ITEM_CLS = MyRow
def get_data(database_id: str) -> MyData:
client = Client(auth=NOTION_TOKEN)
data = client.databases.query(
**Query(database_id=database_id).filter(
MyRow.name.filter.is_not_empty(True)
).serialize()
)
return MyData(data=data)
def create_page(database_id: str) -> MyRow:
client = Client(auth=NOTION_TOKEN)
page = MyRow.make(
parent={'database_id': database_id},
children = PageBlock.make(
to_do = 'Сделать тест'
),
name = ['TestPage'],
doing = 'Слежу',
tags = ['На проверке'],
link = 'wildberries.com'
)
response = client.pages.create(**page.data)
item = MyRow(data=response)
return item
create_page(DATABASE_ID)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.