# notion-apilib-python
This library allows developers to work with Notion API using custom DSL Pydantic models, removing the need to manually
construct json payloads and API requests or handle JSON responses. The library wraps the Notion REST API, transforming
the calls into intuitive custom API methods that accept and return custom Pydantic objects. Also provides factory
methods
for easy instantiation of these custom objects.
## Key Features
- Schema Enforcement: Ensures data integrity by validating all objects against Notion's API schema using Pydantic.
- Factory Methods: Simplifies the creation of Notion objects with pre-configured factory methods.
- Provide a high-level abstraction over Notion's REST API. Abstracting away the low-level details of the API like json
structure, formats and URL's.
- Simple and intuitive syntax for creating, retrieving, updating, and deleting Notion objects like Pages, Databases
and Blocks.
- Supports pagination, filtering, sorting, and other advanced features.
## Installation
You can install the package via pip, link to the package -
[PyPi Package](https://pypi.org/project/notion-apilib/)
```bash
pip install notion-apilib
```
## Usage
```python
from notion_apilib import NotionApi
# Initialize the client
client = NotionApi(api_key="your_notion_integration_secret_api_key")
# Access the notion object providers / accessors:
page_provider = client.page_provider
blocks_provider = client.block_provider
database_provider = client.database_provider
# Example usage
database = database_provider.retrieve_database("your_database_id")
page = page_provider.retrieve_page("your_page_id")
```
## Documentation
[Usage Examples](docs/examples) \
[Changelog](CHANGELOG.md)
### Modules
#### notion-apilib:
- Contains the core NotionApi class used for accessing the pages, database and blocks providers used for interacting
with Notion API.
#### notion-apilib.data:
- Contains inside Pydantic models and factory methods for Notion objects like Page, Database, Block, Properties, etc.
#### notion-apilib.data.blocks:
- Pydantic models and factory methods for blocks.
#### notion-apilib.data.properties:
- Pydantic models and factory methods for page and database properties as well as Filter and Sort objects.
#### notion-apilib.data.structures:
- Pydantic models and factory methods for low-level structures like RichText and Annotations used by other objects.
### External:
1. [Notion API Documentation](https://developers.notion.com/reference/intro)
2. [Developers Notion](https://developers.notion.com/)
3. [Notion Integration](https://notionintegrations.com/)
## Contributing
This is my first library, and I know it might not be perfect. I welcome any suggestions, code reviews, documentation
improvements, bug reports or feature requests. Please feel free to contribute to the project.
### How to Contribute
1. Fork the repository.
2. Create a new branch (git checkout -b feature-branch).
3. Make your changes and commit them (git commit -am 'Add new feature').
4. Push the branch (git push origin feature-branch).
5. Open a Pull Request.
For major changes, please open an issue first to discuss what you would like to change.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
## Feedback
As this is my first library, any constructive criticism or feedback is greatly appreciated. Whether it's a suggestion
for improvement or just a comment on how the library could be better, I'm eager to hear your thoughts. Please don't
hesitate to reach out if you have any ideas, feedback, or feature requests.
Raw data
{
"_id": null,
"home_page": "https://github.com/Real1tyy/notion-apilib-python",
"name": "notion-apilib",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "notion, api, pydantic, dsl, python",
"author": "Real1ty",
"author_email": "vavro.matej3@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c7/d8/c575d537f6266d30eb4b5ad24a89049ab413f4491c683e2e781e9f42155b/notion_apilib-0.0.1a0.tar.gz",
"platform": null,
"description": "# notion-apilib-python\n\nThis library allows developers to work with Notion API using custom DSL Pydantic models, removing the need to manually\nconstruct json payloads and API requests or handle JSON responses. The library wraps the Notion REST API, transforming\nthe calls into intuitive custom API methods that accept and return custom Pydantic objects. Also provides factory\nmethods\nfor easy instantiation of these custom objects.\n\n## Key Features\n\n- Schema Enforcement: Ensures data integrity by validating all objects against Notion's API schema using Pydantic.\n- Factory Methods: Simplifies the creation of Notion objects with pre-configured factory methods.\n- Provide a high-level abstraction over Notion's REST API. Abstracting away the low-level details of the API like json\n structure, formats and URL's.\n- Simple and intuitive syntax for creating, retrieving, updating, and deleting Notion objects like Pages, Databases\n and Blocks.\n- Supports pagination, filtering, sorting, and other advanced features.\n\n## Installation\n\nYou can install the package via pip, link to the package -\n[PyPi Package](https://pypi.org/project/notion-apilib/)\n\n```bash\npip install notion-apilib\n```\n\n## Usage\n\n```python\nfrom notion_apilib import NotionApi\n\n# Initialize the client\nclient = NotionApi(api_key=\"your_notion_integration_secret_api_key\")\n\n# Access the notion object providers / accessors:\npage_provider = client.page_provider\nblocks_provider = client.block_provider\ndatabase_provider = client.database_provider\n\n# Example usage\ndatabase = database_provider.retrieve_database(\"your_database_id\")\npage = page_provider.retrieve_page(\"your_page_id\")\n```\n\n## Documentation\n\n[Usage Examples](docs/examples) \\\n[Changelog](CHANGELOG.md)\n\n### Modules\n\n#### notion-apilib:\n\n- Contains the core NotionApi class used for accessing the pages, database and blocks providers used for interacting\n with Notion API.\n\n#### notion-apilib.data:\n\n- Contains inside Pydantic models and factory methods for Notion objects like Page, Database, Block, Properties, etc.\n\n#### notion-apilib.data.blocks:\n\n- Pydantic models and factory methods for blocks.\n\n#### notion-apilib.data.properties:\n\n- Pydantic models and factory methods for page and database properties as well as Filter and Sort objects.\n\n#### notion-apilib.data.structures:\n\n- Pydantic models and factory methods for low-level structures like RichText and Annotations used by other objects.\n\n### External:\n\n1. [Notion API Documentation](https://developers.notion.com/reference/intro)\n2. [Developers Notion](https://developers.notion.com/)\n3. [Notion Integration](https://notionintegrations.com/)\n\n## Contributing\n\nThis is my first library, and I know it might not be perfect. I welcome any suggestions, code reviews, documentation\nimprovements, bug reports or feature requests. Please feel free to contribute to the project.\n\n### How to Contribute\n\n1. Fork the repository.\n2. Create a new branch (git checkout -b feature-branch).\n3. Make your changes and commit them (git commit -am 'Add new feature').\n4. Push the branch (git push origin feature-branch).\n5. Open a Pull Request.\n\nFor major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Feedback\n\nAs this is my first library, any constructive criticism or feedback is greatly appreciated. Whether it's a suggestion\nfor improvement or just a comment on how the library could be better, I'm eager to hear your thoughts. Please don't\nhesitate to reach out if you have any ideas, feedback, or feature requests.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "This library allows developers to call Notion API using custom DSL Pydantic-validated classes and API methods",
"version": "0.0.1a0",
"project_urls": {
"Documentation": "https://github.com/Real1tyy/notion-apilib-python/wiki",
"Homepage": "https://github.com/Real1tyy/notion-apilib-python",
"Repository": "https://github.com/Real1tyy/notion-apilib-python"
},
"split_keywords": [
"notion",
" api",
" pydantic",
" dsl",
" python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c6dd91307c68da4ade2300ab3373d674704ef850879acf9507babdb8d71e56e8",
"md5": "179a2f52ae5105bdc10677c7e00646fb",
"sha256": "c5744aa8e7f61d070c7d630b91e973b40da8f24a9d1f731bd196d0762fc47462"
},
"downloads": -1,
"filename": "notion_apilib-0.0.1a0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "179a2f52ae5105bdc10677c7e00646fb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 107787,
"upload_time": "2024-08-17T20:17:58",
"upload_time_iso_8601": "2024-08-17T20:17:58.987191Z",
"url": "https://files.pythonhosted.org/packages/c6/dd/91307c68da4ade2300ab3373d674704ef850879acf9507babdb8d71e56e8/notion_apilib-0.0.1a0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c7d8c575d537f6266d30eb4b5ad24a89049ab413f4491c683e2e781e9f42155b",
"md5": "58994850052ed8fb8256c8125c4c0c18",
"sha256": "ae6273fe63186166ab5820f898e0a2f2a927744f5bbf795b876f9b6184bba256"
},
"downloads": -1,
"filename": "notion_apilib-0.0.1a0.tar.gz",
"has_sig": false,
"md5_digest": "58994850052ed8fb8256c8125c4c0c18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 63641,
"upload_time": "2024-08-17T20:18:01",
"upload_time_iso_8601": "2024-08-17T20:18:01.170580Z",
"url": "https://files.pythonhosted.org/packages/c7/d8/c575d537f6266d30eb4b5ad24a89049ab413f4491c683e2e781e9f42155b/notion_apilib-0.0.1a0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-17 20:18:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Real1tyy",
"github_project": "notion-apilib-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "notion-apilib"
}