All functions that assist in standardising development approaches.
Project description
The base URL to send all API requests is https://api.notion.com. Link to notion API documentation: https://developers.notion.com/reference/patch-block-children
Both request and responses are encoded as JSON.
SECRET KEY: API access require creating an "internal integration app" in python, which would produce a secret key, by which you can use to access its API services. https://www.notion.so/my-integrations.
Message structure
- Constant
JSON conventions - "object": Type of top-level resource (e.g database, user) - "id": Specific top level resource - Property names -> This is in a_b format - Temporial values -> date time in ISO 8601 string format - Does not support empty strings (e.g. ""). Use null value instead.
Top-level resources are addressable by a UUIDv4 "id" property. You may omit dashes from the ID when making requests to the API, e.g. when copying the ID from a Notion URL. Property names are in snake_case (not camelCase or kebab-case). Temporal values (dates and datetimes) are encoded in ISO 8601 strings. Datetimes will include the time value (2020-08-12T02:12:33.231Z) while dates will include only the date (2020-08-12) The Notion API does not support empty strings. To unset a string value for properties like a url Property value object, for example, use an explicit null instead of "".
Response database structure
''' Request structure
Response structure
'''
Change log
[1.5.1] - 2024-09-08
add: fixed:
- get_logger: Direct import of logger variable does not change for files that import it when logger changes. others:
[1.5.0] - 2024-09-07
add:
- insert_logger: takes in a class instance of log_data and place it in logger variable.
- Logger: added a variable from which log_data operations can be executed from
- Log method execution encapsulation in a try except block. fixed: others:
- Log method execution encapsulation: To ensure that package operation is not affected by errors in log method.
[1.4.1] - 2024-06-20
add:
- Added logs to all functions, except test fixed: others:
[1.4.0] - 2024-06-19
add:
- pages: append_text_to_text_block function. Take a text block, and add more text to it
- Pages: create_page_in_page function. Create a child page in a parent page.
- Pages: add_text_blocks function. Add text blocks at the bottom of a page.
- Pages: extract_data_from_encapsulations operation, to extract only ids for each block fixed: others:
- Objective that made me create these functions: custom_logger, store log data in notion if database storing fails.
[1.3.0] - 2024-06-18
add:
- Pages: Create page in page function. fixed: others:
[1.2.0] - 2024-06-18
add:
- Pages: extract_data function created. (See explanation 1 in others section)
- Pages: extract_all_direct_core_data_encapsulation (Using a single row, extract the data)
- Pages: extract_data_from_encapsulations (apply specific rule meant for extracting specific data aspect). See explanation 2 and function source code to get a precise understanding. fixed: others:
- table: Comment out function execution at the bottom of the file, which was meant for testing
- Explanation 1: Extract the encapsulation of the data (getting as close as possible to it) using a rule for all block types. Depending on the aspect of the data you want to extract (see explanation 2), use either extract_text or extract page function for each row data. Extract the data aspect.
- Explanation 2: page -> extract_page, text -> extract_text.
- Why was these created: There are way too many block types and I cannot find a way to adapt previous operation to capture the core data of all various block types. Therefore, a new structure is created, where a parameter objective (currently either text or pages) is explicitly set in a parameter (data_type), and a specific pre-defined operation will be applied on all blocks, to produce outcomes that match that objective.
[1.1.1] - 2024-06-11
add:
- Init: Added shortcut to table fixed:
- Table: Forgot to remove import statement to a package that does not exist (page) others:
[1.1.0] - 2024-06-11
add:
- Table: plain table processing script.
- extract_core_table_data: table to turn raw indented data from notion server to an array of array of strings. fixed: others:
- Incorporated generate_outcome_message function into page functions
- Incorporated generate_outcome_message function into database functions
[1.0.0] - 2024-06-08
add:
- Database: Extract data from databases in notion
- Page: Extract data from page fixed: others:
- Notes: The description of the structure of the return value, because the structure of the return object has a lot of indentations and a lot of meta data. Purpose of notes is to make clear of where the core data is (e.g. text in a block).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file personalNotion-1.5.1-py3-none-any.whl
.
File metadata
- Download URL: personalNotion-1.5.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b0fc65de361e34ae22790c5f9eac97eae3e315d2d24379fb1ecd91deb4e7269 |
|
MD5 | 930944a858722dbba2f6a9c7b8c18922 |
|
BLAKE2b-256 | 0137015a92f003736a988e5fc385b709d3a4d80aa7ea7bed0f8b478dd9b8e568 |