FastComments.com

FastComments Python SDK

This is the official Python SDK for FastComments.

Official Python SDK for the FastComments API

Repository

View on GitHub

Installation Internal Link

PyPI

pip install fastcomments-python

Library Contents

This library contains two modules: the generated API client and the core Python library which contains hand-written utilities to make working with the API easier, including SSO support.

Public vs Secured APIs

For the API client, there are two classes, DefaultApi and PublicApi. The DefaultApi contains methods that require your API key, and PublicApi contains API calls that can be made directly from a browser/mobile device/etc without authentication.

Development Internal Link

Running Tests

# Set up environment variables
export FASTCOMMENTS_API_KEY="your-api-key"
export FASTCOMMENTS_TENANT_ID="your-tenant-id"

# Run tests
pytest tests/

Regenerating the Client

To regenerate the API client from the latest OpenAPI specification:

./update.sh

This will:

  1. Download the latest OpenAPI spec from a running FastComments server (or use local openapi.yaml)
  2. Generate the Python client code
  3. Flatten the directory structure
  4. Clean up redundant configuration files

Notes Internal Link

Broadcast IDs

You'll see you're supposed to pass a broadcast_id in some API calls. When you receive events, you'll get this ID back, so you know to ignore the event if you plan to optimistically apply changes on the client (which you'll probably want to do since it offers the best experience). Pass a UUID here. The ID should be unique enough to not occur twice in a browser session.

Requirements Internal Link

  • Python >= 3.8
  • urllib3 >= 1.25.3
  • python-dateutil >= 2.8.2
  • pydantic >= 2.0.0
  • typing-extensions >= 4.0.0

Need Help?

If you encounter any issues or have questions about the Python SDK, please:

Contributing

Contributions are welcome! Please visit the GitHub repository for contribution guidelines.