Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanboard/python-api-client
Python API Client for Kanboard
https://github.com/kanboard/python-api-client
api api-client json-rpc kanboard python
Last synced: 2 days ago
JSON representation
Python API Client for Kanboard
- Host: GitHub
- URL: https://github.com/kanboard/python-api-client
- Owner: kanboard
- License: mit
- Created: 2016-01-23T14:37:55.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2024-12-08T22:04:57.000Z (23 days ago)
- Last Synced: 2024-12-22T20:07:08.311Z (9 days ago)
- Topics: api, api-client, json-rpc, kanboard, python
- Language: Python
- Homepage: https://pypi.org/project/kanboard
- Size: 52.7 KB
- Stars: 81
- Watchers: 5
- Forks: 26
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
==============================
Python API Client for Kanboard
==============================Client library for Kanboard API.
- Author: Frédéric Guillot
- License: MITInstallation
============.. code-block:: bash
python3 -m pip install kanboard
This library is compatible with Python >= 3.7.
Note: **Support for Python 2.7 has been dropped since version 1.1.0.**
On Fedora (36 and later), you can install the package using DNF:
.. code-block:: bash
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
---------------------------.. code-block:: python
import kanboard
kb = kanboard.Client('http://localhost/jsonrpc.php', 'jsonrpc', 'your_api_token')
project_id = kb.create_project(name='My project')Authenticate as user
--------------------.. code-block:: python
import kanboard
kb = kanboard.Client('http://localhost/jsonrpc.php', 'admin', 'secret')
kb.get_my_projects()Create a new task
-----------------.. code-block:: python
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
-----------------------------.. code-block:: python
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:
.. code-block:: python
import kanboard
kb = kanboard.Client('https://example.org/jsonrpc.php', 'admin', 'secret')
kb.get_my_projects()Example with a custom certificate:
.. code-block:: python
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:
.. code-block:: python
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:
.. code-block:: python
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... code-block:: python
import asyncio
import kanboardkb = 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')).. code-block:: python
import asyncio
import kanboardasync 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.