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

Bumps minimum Python version to 3.9 #25

Merged
merged 2 commits into from
Jul 17, 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/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.x'

- name: Install Poetry
uses: snok/install-poetry@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- name: Checkout repository
Expand Down
30 changes: 15 additions & 15 deletions keystone_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from collections import namedtuple
from datetime import datetime
from functools import partial
from typing import *
from typing import Literal, Union
from warnings import warn

import jwt
Expand All @@ -20,8 +20,8 @@

# Custom types
ContentType = Literal["json", "text", "content"]
ResponseContent = Union[Dict[str, Any], str, bytes]
QueryResult = Union[None, dict, List[dict]]
ResponseContent = Union[dict[str, any], str, bytes]
QueryResult = Union[None, dict, list[dict]]
HTTPMethod = Literal["get", "post", "put", "patch", "delete"]

# API schema mapping human-readable, python-friendly names to API endpoints
Expand Down Expand Up @@ -58,11 +58,11 @@ def __init__(self, url: str) -> None:
"""

self._url = url.rstrip('/')
self._api_version: Optional[str] = None
self._access_token: Optional[str] = None
self._access_expiration: Optional[datetime] = None
self._refresh_token: Optional[str] = None
self._refresh_expiration: Optional[datetime] = None
self._api_version: str | None = None
self._access_token: str | None = None
self._access_expiration: datetime | None = None
self._refresh_token: str | None = None
self._refresh_expiration: datetime | None = None

def __new__(cls, *args, **kwargs) -> KeystoneClient:
"""Dynamically create CRUD methods for each endpoint in the API schema
Expand All @@ -85,8 +85,8 @@ def __new__(cls, *args, **kwargs) -> KeystoneClient:
def _retrieve_records(
self,
_endpoint: str,
pk: Optional[int] = None,
filters: Optional[dict] = None,
pk: int | None = None,
filters: dict | None = None,
timeout=default_timeout
) -> QueryResult:
"""Retrieve data from the specified endpoint with optional primary key and filters
Expand Down Expand Up @@ -118,7 +118,7 @@ def _retrieve_records(

raise

def _get_headers(self) -> Dict[str, str]:
def _get_headers(self) -> dict[str, str]:
"""Return header data for API requests

Returns:
Expand Down Expand Up @@ -167,7 +167,7 @@ def url(self) -> str:
def http_get(
self,
endpoint: str,
params: Optional[Dict[str, Any]] = None,
params: dict[str, any] | None = None,
timeout: int = default_timeout
) -> requests.Response:
"""Send a GET request to an API endpoint
Expand All @@ -189,7 +189,7 @@ def http_get(
def http_post(
self,
endpoint: str,
data: Optional[Dict[str, Any]] = None,
data: dict[str, any] | None = None,
timeout: int = default_timeout
) -> requests.Response:
"""Send a POST request to an API endpoint
Expand All @@ -211,7 +211,7 @@ def http_post(
def http_patch(
self,
endpoint: str,
data: Optional[Dict[str, Any]] = None,
data: dict[str, any] | None = None,
timeout: int = default_timeout
) -> requests.Response:
"""Send a PATCH request to an API endpoint
Expand All @@ -233,7 +233,7 @@ def http_patch(
def http_put(
self,
endpoint: str,
data: Optional[Dict[str, Any]] = None,
data: dict[str, any] | None = None,
timeout: int = default_timeout
) -> requests.Response:
"""Send a PUT request to an endpoint
Expand Down
Loading
Loading