Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Installation
python3 -m pip install kanboard


- This library is compatible with Python >= 3.9.
- This library is compatible with Python >= 3.10.

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

Expand Down
19 changes: 10 additions & 9 deletions kanboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import functools
import json
import ssl
from typing import Any, Callable, Dict, Optional
from collections.abc import Callable
from typing import Any
from urllib import request as http

DEFAULT_AUTH_HEADER = "Authorization"
Expand Down Expand Up @@ -59,12 +60,12 @@ def __init__(
username: str,
password: str,
auth_header: str = DEFAULT_AUTH_HEADER,
cafile: Optional[str] = None,
cafile: str | None = None,
insecure: bool = False,
ignore_hostname_verification: bool = False,
user_agent: str = "Kanboard Python API Client",
timeout: Optional[int] = 30,
loop: Optional[asyncio.AbstractEventLoop] = None,
timeout: int | None = 30,
loop: asyncio.AbstractEventLoop | None = None,
) -> None:
"""
Initialize a new Kanboard API client instance.
Expand All @@ -75,15 +76,15 @@ def __init__(
username (str): Kanboard API username or real username.
password (str): Kanboard API token or user password.
auth_header (str, optional): HTTP header for authentication. Defaults to 'Authorization'.
cafile (Optional[str], optional): Path to a custom CA certificate file. Defaults to None.
cafile (str | None, optional): Path to a custom CA certificate file. Defaults to None.
insecure (bool, optional): If True, ignore SSL certificate errors and hostname mismatches.
Defaults to False.
ignore_hostname_verification (bool, optional): If True, skip SSL certificate hostname verification.
Defaults to False.
user_agent (str, optional): Custom User-Agent string for HTTP requests. Defaults to
'Kanboard Python API Client'.
timeout (Optional[int], optional): Request timeout in seconds. Defaults to 30. Set to None to disable.
loop (Optional[asyncio.AbstractEventLoop], optional): Asyncio event loop to use. If None, uses the
timeout (int | None, optional): Request timeout in seconds. Defaults to 30. Set to None to disable.
loop (asyncio.AbstractEventLoop | None, optional): Asyncio event loop to use. If None, uses the
current event loop or creates a new one.
"""
self._url = url
Expand Down Expand Up @@ -168,7 +169,7 @@ def _parse_response(response: bytes) -> Any:
except ValueError as e:
raise ClientError(f"Failed to parse JSON response: {e}") from e

def _do_request(self, headers: Dict[str, str], body: Dict[str, Any]) -> Any:
def _do_request(self, headers: dict[str, str], body: dict[str, Any]) -> Any:
try:
request = http.Request(self._url, headers=headers, data=json.dumps(body).encode())

Expand Down Expand Up @@ -201,7 +202,7 @@ def execute(self, method: str, **kwargs: Any) -> Any:
"""
payload = {"id": 1, "jsonrpc": "2.0", "method": method, "params": kwargs}

credentials = base64.b64encode("{}:{}".format(self._username, self._password).encode())
credentials = base64.b64encode(f"{self._username}:{self._password}".encode())
auth_header_prefix = "Basic " if self._auth_header == DEFAULT_AUTH_HEADER else ""
headers = {
self._auth_header: auth_header_prefix + credentials.decode(),
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "kanboard"
version = "1.1.8"
description = "Python client library for Kanboard"
readme = "README.rst"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = "MIT"
license-files = ["LICENSE"]
keywords = ["kanboard", "api", "client"]
Expand Down Expand Up @@ -33,4 +33,4 @@ build-backend = "setuptools.build_meta"
line-length = 120

[tool.ruff.lint]
select = ["E", "F", "W", "I"]
select = ["E", "F", "W", "I", "UP"]