1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
Metadata-Version: 2.1
Name: kanboard
Version: 1.1.5
Summary: Client library for Kanboard
Home-page: https://github.com/kanboard/python-api-client
Author: Frederic Guillot
Author-email: fred@kanboard.net
License: MIT
Keywords: kanboard api client
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
License-File: LICENSE
==============================
Python API Client for Kanboard
==============================
Client library for Kanboard API.
- Author: Frédéric Guillot
- License: MIT
Installation
============
.. code-block:: bash
python3 -m pip install kanboard
This library is compatible with Python >= 3.5.
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 <https://docs.kanboard.org/v1/api/>`_.
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 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'))
.. code-block:: python
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 <https://docs.kanboard.org/v1/api/>`_ for the complete list of
methods and arguments.
|