-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase_create.py
47 lines (41 loc) · 1.26 KB
/
database_create.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from potion import Request, NotionHeader
from potion.api import *
from potion.objects import *
token = ''
nh = NotionHeader(authorization=token)
req = Request(nh.headers)
property_list = [
sche.Title('Name'),
sche.RichText('Description'),
sche.CheckBox('In stock'),
sche.Select('Food group',
options=[
sche.Option('🥦Vegetable', 'green'),
sche.Option('🍎Fruit', 'red'),
sche.Option('💪Protein', 'yellow'),
]),
sche.Number('Price', format='dollar'),
sche.AnySchema('last ordered', 'date'),
sche.MultiSelect('Store availability', [
sche.Option('Duc Loi Market', ),
sche.Option('Rainbow Grocery', 'gray'),
sche.Option('Nijiya Market', 'purple'),
sche.Option("Gus's Community Market", 'yellow'),
]),
sche.AnySchema('+1', 'people'),
sche.AnySchema('Photo', 'files'),
]
p = Properties(*property_list)
data = Database(
parent=Parent.PageParent(page_id='a20f7d2442ce4004860541fbada2f61c'),
title=[{
"type": "text",
"text": {
"content": "Grocery List",
"link": None
}
}],
properties=p)
print(data)
print(req.post(url=database_create(),
data=data))