Skip to content

Repository files navigation

ctfd.py

Async Python client for the CTFd API (v1).

PyPI Python License

Documentation · PyPI · Changelog

Installation

uv add ctfd-api
# or
pip install ctfd-api

Requires Python 3.13+.

Quick start

import asyncio
from ctfd import CTFdClient

async def main():
    async with CTFdClient('https://my-ctf.example.com', token='ctfd_...') as ctfd:
        me = await ctfd.users.me()

        async for challenge in ctfd.challenges.iter():
            print(challenge.name, challenge.value)

asyncio.run(main())

Get a token from Profile → API Access Tokens on your CTFd instance.

Dev setup

uv sync                              # install deps + dev tools
uv run pre-commit install            # install git hooks
uv run pytest                        # run tests
uv run ruff check ctfd               # lint
uv run mypy                          # type-check
uv run --group docs mkdocs serve     # live docs preview

License

GPL-3.0-or-later

About

A Python wrapper for the CTFd API — automate and script your CTF platforms with a clean, pythonic interface.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages