Skip to main content

Python client library for Kanboard

Project description

Client library for Kanboard API.

  • Author: Frédéric Guillot

  • License: MIT

Installation

python3 -m pip install kanboard
  • This library is compatible with Python >= 3.9.

  • Python 2.7 is no longer supported since version 1.1.0.

  • Python 3.7 and 3.8 are no longer supported since version 1.1.7.

On Fedora (36 and later), you can install the package using DNF:

dnf install python3-kanboard

Examples

Methods and arguments are the same as the JSON-RPC procedures described in the official documentation.

Python methods are dynamically mapped to the API procedures: You must use named arguments.

By default, calls are made synchronously, meaning that they will block the program until completed.

Creating a new team project

import kanboard

kb = kanboard.Client("http://localhost/jsonrpc.php", "jsonrpc", "your_api_token")
project_id = kb.create_project(name="My project")

Authenticate as user

import kanboard

kb = kanboard.Client("http://localhost/jsonrpc.php", "admin", "secret")
kb.get_my_projects()

Use a custom authentication header

If your Kanboard instance is configured to use a custom authentication header (for example, by setting define('API_AUTHENTICATION_HEADER', 'X-My-Custom-Auth-Header'); in your Kanboard configuration), you can authenticate using the following code:

import kanboard

kb = kanboard.Client(url="http://localhost/jsonrpc.php",
                     username="demo",
                     password="secret",
                     auth_header="X-My-Custom-Auth-Header")

kb.get_me()

Create a new task

import kanboard

kb = kanboard.Client("http://localhost/jsonrpc.php", "jsonrpc", "your_api_token")
project_id = kb.create_project(name="My project")
task_id = kb.create_task(project_id=project_id, title="My task title")

Use a personalized user agent

import kanboard

kb = kanboard.Client(url="http://localhost/jsonrpc.php",
                     username="admin",
                     password="secret",
                     user_agent="My Kanboard client")

SSL connection and self-signed certificates

Example with a valid certificate:

import kanboard

kb = kanboard.Client("https://example.org/jsonrpc.php", "admin", "secret")
kb.get_my_projects()

Example with a custom certificate:

import kanboard

kb = kanboard.Client(url="https://example.org/jsonrpc.php",
                     username="admin",
                     password="secret",
                     cafile="/path/to/my/cert.pem")
kb.get_my_projects()

Example with a custom certificate and hostname mismatch:

import kanboard

kb = kanboard.Client(url="https://example.org/jsonrpc.php",
                     username="admin",
                     password="secret",
                     cafile="/path/to/my/cert.pem",
                     ignore_hostname_verification=True)
kb.get_my_projects()

Ignore invalid/expired certificates and hostname mismatches, which will make your application vulnerable to man-in-the-middle (MitM) attacks:

import kanboard

kb = kanboard.Client(url="https://example.org/jsonrpc.php",
                     username="admin",
                     password="secret",
                     insecure=True)
kb.get_my_projects()

Asynchronous I/O

The client also exposes async/await style method calls. Similarly to the synchronous calls (see above), the method names are mapped to the API methods.

To invoke an asynchronous call, the method name must be appended with _async. For example, a synchronous call to create_project can be made asynchronous by calling create_project_async instead.

import asyncio
import kanboard

kb = kanboard.Client("http://localhost/jsonrpc.php", "jsonrpc", "your_api_token")

loop = asyncio.get_event_loop()
project_id = loop.run_until_complete(kb.create_project_async(name="My project"))
import asyncio
import kanboard

async def call_within_function():
    kb = kanboard.Client("http://localhost/jsonrpc.php", "jsonrpc", "your_api_token")
    return await kb.create_project_async(name="My project")

loop = asyncio.get_event_loop()
project_id = loop.run_until_complete(call_within_function())

See the official API documentation for the complete list of methods and arguments.

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

kanboard-1.1.7.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

kanboard-1.1.7-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file kanboard-1.1.7.tar.gz.

File metadata

  • Download URL: kanboard-1.1.7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kanboard-1.1.7.tar.gz
Algorithm Hash digest
SHA256 3177f53cfeb8dfb60789c44f04636d30c8990fc9a48b46daa894c9708c351269
MD5 23e576bcbb20ed0f6825125daebc75be
BLAKE2b-256 02912f480b533dbe6646eafb41689799dcda02f003f0494be12ab52d548418e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for kanboard-1.1.7.tar.gz:

Publisher: publish.yml on kanboard/python-api-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kanboard-1.1.7-py3-none-any.whl.

File metadata

  • Download URL: kanboard-1.1.7-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kanboard-1.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ce81ca3f399b16dc6d992542ccd03d3f44b5fac28a06eb0733d70f66d529a4c8
MD5 a808dd22b6b9b2d7f58c7c8d4c69eb9d
BLAKE2b-256 ad46aabb76da4d447c14cabbed5edceab26bac2eed09e9bcc02af24d3719f966

See more details on using hashes here.

Provenance

The following attestation bundles were made for kanboard-1.1.7-py3-none-any.whl:

Publisher: publish.yml on kanboard/python-api-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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