Skip to main content

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

  1. 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.4.1] - 2024-06-20

add:

  1. Added logs to all functions, except test fixed: others:

[1.4.0] - 2024-06-19

add:

  1. pages: append_text_to_text_block function. Take a text block, and add more text to it
  2. Pages: create_page_in_page function. Create a child page in a parent page.
  3. Pages: add_text_blocks function. Add text blocks at the bottom of a page.
  4. Pages: extract_data_from_encapsulations operation, to extract only ids for each block fixed: others:
  5. 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:

  1. Pages: Create page in page function. fixed: others:

[1.2.0] - 2024-06-18

add:

  1. Pages: extract_data function created. (See explanation 1 in others section)
  2. Pages: extract_all_direct_core_data_encapsulation (Using a single row, extract the data)
  3. 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:
  4. table: Comment out function execution at the bottom of the file, which was meant for testing
  5. 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.
  6. Explanation 2: page -> extract_page, text -> extract_text.
  7. 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:

  1. Init: Added shortcut to table fixed:
  2. Table: Forgot to remove import statement to a package that does not exist (page) others:

[1.1.0] - 2024-06-11

add:

  1. Table: plain table processing script.
  2. extract_core_table_data: table to turn raw indented data from notion server to an array of array of strings. fixed: others:
  3. Incorporated generate_outcome_message function into page functions
  4. Incorporated generate_outcome_message function into database functions

[1.0.0] - 2024-06-08

add:

  1. Database: Extract data from databases in notion
  2. Page: Extract data from page fixed: others:
  3. 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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

personalNotion-1.4.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file personalNotion-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for personalNotion-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a559c2aa022d6d24fe3a9d974e79363cc8f5afeea1d73bcbf2969fc05ac764c
MD5 9d6ff0ffb6e3703f05e286b9f77c5e37
BLAKE2b-256 b63c27ac0f66be46b02654ac0d927373866f2f265dc7c4f1eefafa38e6019b74

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page