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

Install from GitHub

Install directly from a release tag (recommended, fully reproducible):

pip install git+https://github.com/fastcomments/fastcomments-python.git@v3.0.0

Pin the tag rather than a branch so builds are deterministic. The same form works in requirements.txt:

fastcomments @ git+https://github.com/fastcomments/fastcomments-python.git@v3.0.0

Each tagged GitHub Release also has a built wheel attached if you prefer to install a binary artifact directly.

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 three classes, DefaultApi, PublicApi, and ModerationApi. The DefaultApi contains methods that require your API key, and PublicApi contains methods that can be made directly from a browser/mobile device/etc without authentication. The ModerationApi provides an extensive suite of live and fast moderation APIs. Every ModerationApi method accepts an sso parameter and can authenticate via SSO or a FastComments.com session cookie.

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

The base install is pure-stdlib and provides the SSO utilities. The generated API client (DefaultApi/PublicApi/ModerationApi) needs the client extra, which pulls in urllib3 >= 1.25.3, python-dateutil >= 2.8.2, pydantic >= 2.0.0, and typing-extensions >= 4.0.0:

pip install "fastcomments[client] @ git+https://github.com/fastcomments/fastcomments-python.git@v3.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.