Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add older Python versions to test matrix #33

Merged
merged 2 commits into from
Sep 4, 2024
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 @@ -13,7 +13,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: ["3.11", "3.12"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
31 changes: 16 additions & 15 deletions miniflux.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# THE SOFTWARE.

import json
from typing import List, Optional, Union

import requests

Expand Down Expand Up @@ -104,18 +105,18 @@ class Client:
def __init__(
self,
base_url: str,
username: str | None = None,
password: str | None = None,
username: Optional[str] = None,
password: Optional[str] = None,
timeout: float = 30.0,
api_key: str | None = None,
api_key: Optional[str] = None,
user_agent: str = DEFAULT_USER_AGENT,
):
self._base_url = base_url
self._api_key = api_key
self._username = username
self._password = password
self._timeout = timeout
self._auth: tuple | None = (
self._auth: Optional[tuple] = (
(self._username, self._password) if not api_key else None
)
self._headers = {"User-Agent": user_agent}
Expand All @@ -128,7 +129,7 @@ def _get_endpoint(self, path: str) -> str:

return f"{self._base_url}/v{self.API_VERSION}{path}"

def _get_params(self, **kwargs) -> dict | None:
def _get_params(self, **kwargs) -> Optional[dict]:
params = {k: v for k, v in kwargs.items() if v}
return params if len(params) > 0 else None

Expand Down Expand Up @@ -248,7 +249,7 @@ def import_feeds(self, opml: str) -> dict:
return response.json()
self._handle_error_response(response)

def discover(self, website_url: str, **kwargs) -> list[dict]:
def discover(self, website_url: str, **kwargs) -> List[dict]:
"""
Discover feeds from a website.

Expand All @@ -274,7 +275,7 @@ def discover(self, website_url: str, **kwargs) -> list[dict]:
return response.json()
self._handle_error_response(response)

def get_category_feeds(self, category_id: int) -> list[dict]:
def get_category_feeds(self, category_id: int) -> List[dict]:
"""
Retrieves a list of feeds for a given category.

Expand All @@ -293,7 +294,7 @@ def get_category_feeds(self, category_id: int) -> list[dict]:
return response.json()
self._handle_error_response(response)

def get_feeds(self) -> list[dict]:
def get_feeds(self) -> List[dict]:
"""
Retrieves a list of all feeds.

Expand Down Expand Up @@ -381,7 +382,7 @@ def get_icon_by_feed_id(self, feed_id: int) -> dict:
return self.get_feed_icon(feed_id)

def create_feed(
self, feed_url: str, category_id: int | None = None, **kwargs
self, feed_url: str, category_id: Optional[int] = None, **kwargs
) -> int:
"""
Create a new feed.
Expand Down Expand Up @@ -608,7 +609,7 @@ def get_entries(self, **kwargs) -> dict:
self._handle_error_response(response)

def update_entry(
self, entry_id: int, title: str | None = None, content: str | None = None
self, entry_id: int, title: Optional[str] = None, content: Optional[str] = None
) -> dict:
"""
Update an entry.
Expand Down Expand Up @@ -640,7 +641,7 @@ def update_entry(
return response.json()
self._handle_error_response(response)

def update_entries(self, entry_ids: list[int], status: str) -> bool:
def update_entries(self, entry_ids: List[int], status: str) -> bool:
"""
Change the status of multiple entries.

Expand Down Expand Up @@ -742,7 +743,7 @@ def get_enclosure(self, enclosure_id: int) -> dict:
self._handle_error_response(response)

def update_enclosure(
self, enclosure_id: int, media_progression: int | None = None
self, enclosure_id: int, media_progression: Optional[int] = None
) -> bool:
"""
Update an enclosure.
Expand All @@ -768,7 +769,7 @@ def update_enclosure(
self._handle_error_response(response)
return True

def get_categories(self) -> list[dict]:
def get_categories(self) -> List[dict]:
"""
Fetch all categories.

Expand Down Expand Up @@ -910,7 +911,7 @@ def mark_category_entries_as_read(self, category_id: int) -> None:
if response.status_code != 204:
self._handle_error_response(response)

def get_users(self) -> list[dict]:
def get_users(self) -> List[dict]:
"""
Fetch all users.

Expand Down Expand Up @@ -953,7 +954,7 @@ def get_user_by_username(self, username: str) -> dict:
"""
return self._get_user(username)

def _get_user(self, user_id_or_username: str | int) -> dict:
def _get_user(self, user_id_or_username: Union[str, int]) -> dict:
endpoint = self._get_endpoint(f"/users/{user_id_or_username}")
response = requests.get(
endpoint, headers=self._headers, auth=self._auth, timeout=self._timeout
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "miniflux"
version = "1.1.0"
version = "1.1.1"
description = "Client library for Miniflux"
readme = "README.rst"
requires-python = ">=3.7"
Expand Down