Skip to main content

Python SDK for interacting with Slite API

Project description

pySlite

PyPI package version number Actions Status PyPI downloads License

Unofficial Python SDK for Slite API.

Installation

$ pip install pyslite

Usage

This SDK provides a simple way to interact with the Slite API. Here's how to use it:

from pyslite.client import Client

# Replace with your actual API key
api_key = "YOUR_SLITE_API_KEY"
client = Client(api_key)

# Get a note by ID
note = client.get_note("your_note_id")
if note:
    print(f"Note Title: {note.title}")
    print(f"Note Content: {note.content}") #Note content is markdown
else:
    print("Failed to retrieve note.")

# Create a new note
response = client.create_note(
    parent_note_id="your_parent_note_id",
    template_id="your_template_id",
    title="My New Note",
    content="# My New Note\nThis is the content of my new note."
)
if response:
    print(f"Note created successfully! Status code: {response.status_code}")
else:
    print("Failed to create note.")

#Fetch all notes recursively under a given note.
all_notes = client.fetch_notes_recursive("your_root_note_id")
if all_notes:
    for note in all_notes:
        print(f"Note Title: {note.title}")
else:
    print("Failed to fetch notes.")

Remember to replace "your_note_id", "your_parent_note_id", "your_template_id", and "your_root_note_id" with actual Slite note IDs.

Features

  • Get Note: Retrieves a single note by its ID.
  • Create Note: Creates a new note with specified parent, template, title, and markdown content.
  • Fetch Notes Recursively: Retrieves a note and all its children recursively.

Error Handling

The library includes robust error handling. If a request fails, it will print an informative error message to the console and return None.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyslite-0.0.5.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyslite-0.0.5-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file pyslite-0.0.5.tar.gz.

File metadata

  • Download URL: pyslite-0.0.5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyslite-0.0.5.tar.gz
Algorithm Hash digest
SHA256 55b4650256a449b941a19de87c7c86e0df022ce0b776ab9c2bece114fa87136d
MD5 801e9d9a6741560caff4a90c0553287c
BLAKE2b-256 102dbcda9d5237529e42d254e9b7a93f6bba55060d614643239a6fd73acf2622

See more details on using hashes here.

File details

Details for the file pyslite-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyslite-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyslite-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8a74d60c7b9b8e1f4c1df73945f9d8020098510e20d406b63be039c6b5040be0
MD5 c4e0e7020966e00b3f6601309849502d
BLAKE2b-256 0ac0e90a83119b7ecc244ab83b1e7686a52a4348b8ea9cc0070f0c7ae4ff377c

See more details on using hashes here.

Supported by

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