property
notion.property
RESEARCH_API_PATH
module-attribute
Filter
Filter class for handling Notion Filter object. Please see https://developers.notion.com/reference/post-database-query-filter for detail.
You can now query to notion DB with filtering as following:
import SaigeToolkit.SaigeToolkit.notion as notion
filter_1 = notion.property.Select.get_filter("select_col", "equals", "sel1")
filter_2 = notion.property.Number.get_filter("number_col", "does_not_equal", 10)
filter_3 = notion.property.Checkbox.get_filter("checkbox_col", "does_not_equal", True)
filter_4 = notion.filter.Filter.compound("and", [filter_1, filter_2, filter_3])
_, _, results = notion.database.query_database(
db_id,
RESEARCH_API_PATH,
request_body=filter_4.to_dict()
)
See notion.so/8cd58f07a254405ebb1bc327d690c8aa for more examples.
Source code in ResearchToolkit/notion/filter.py
to_dict
Source code in ResearchToolkit/notion/filter.py
BasicProperty
Notion database basic properties are implemented. It converts values into property object structures specified by the notion api. Additionally, it can check whether given value is valid for the property. Note that status property is not implemented due to the limited notion api capabilites.
Source code in ResearchToolkit/notion/property.py
__init_subclass__
Source code in ResearchToolkit/notion/property.py
__call__
get_value
classmethod
extracts values from a property object structure specified by the notion api. (opposite operation of call method)
Parameters:
-
property_(dict) –property dictionary output of notion api. must include "type" key.
Returns:
-
_type_–value of given property. ex) 3.14 in above example.
Source code in ResearchToolkit/notion/property.py
get_filter
classmethod
Source code in ResearchToolkit/notion/property.py
Text
Title
Number
Bases: BasicProperty
Source code in ResearchToolkit/notion/property.py
Select
MultiSelect
Bases: BasicProperty
value should be a string or list of strings.
Source code in ResearchToolkit/notion/property.py
__bool__
__call__
Date
Bases: BasicProperty
date should be in iso-format.
Source code in ResearchToolkit/notion/property.py
__bool__
Source code in ResearchToolkit/notion/property.py
__call__
Source code in ResearchToolkit/notion/property.py
Person
Bases: BasicProperty
value should be either name or email used in Notion.
Source code in ResearchToolkit/notion/property.py
user_names
class-attribute
instance-attribute
user_emails
class-attribute
instance-attribute
validate_member
get_id
__bool__
__call__
get_person_with_user_info
classmethod
Files
Bases: BasicProperty
only files on remotes can be uploaded.
Source code in ResearchToolkit/notion/property.py
__bool__
__call__
Checkbox
Bases: BasicProperty
Source code in ResearchToolkit/notion/property.py
Url
Bases: BasicProperty
Source code in ResearchToolkit/notion/property.py
Email
Bases: BasicProperty
Source code in ResearchToolkit/notion/property.py
Phone
Bases: BasicProperty
Source code in ResearchToolkit/notion/property.py
Relation
Bases: BasicProperty
value should be a notion page id