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

Fix UTC Import error for Python < 3.11 #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 __init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__='0.6.1'
__version__ = "0.6.1"
6 changes: 3 additions & 3 deletions src/pyconnectwise/clients/automate_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import typing
from datetime import UTC, datetime
from datetime import datetime, timezone

from pyconnectwise.clients.connectwise_client import ConnectWiseClient
from pyconnectwise.config import Config
Expand Down Expand Up @@ -68,7 +68,7 @@ def __init__(
self.automate_url: str = automate_url
self.username: str = username
self.password: str = password
self.token_expiry_time: datetime = datetime.now(tz=UTC)
self.token_expiry_time: datetime = datetime.now(tz=timezone.utc)

if config:
self.config = config
Expand Down Expand Up @@ -246,7 +246,7 @@ def _get_access_token(self) -> str:
return token

def _refresh_access_token_if_necessary(self): # noqa: ANN202
if datetime.now(tz=UTC) > self.token_expiry_time:
if datetime.now(tz=timezone.utc) > self.token_expiry_time:
self.access_token = self._get_access_token()

def _get_headers(self) -> dict[str, str]:
Expand Down
4 changes: 2 additions & 2 deletions src/pyconnectwise/clients/connectwise_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _make_request( # noqa: C901
# I don't like having to cast the params to a dict, but it's the only way I can get mypy to stop complaining about the type.
# TypedDicts aren't compatible with the dict type and this is the best way I can think of to handle this.
if data:
response = requests.request( # noqa: S113
response = requests.request(
method,
url,
headers=headers,
Expand All @@ -80,7 +80,7 @@ def _make_request( # noqa: C901
stream=stream,
)
else:
response = requests.request( # noqa: S113
response = requests.request(
method,
url,
headers=headers,
Expand Down
4 changes: 3 additions & 1 deletion src/pyconnectwise/models/manage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9883,7 +9883,9 @@ class Member(ConnectWiseModel):
invoice_screen_default_tab_format: Annotated[
Literal["ShowInvoicingTab", "ShowAgreementInvoicingTab"], Field(alias="invoiceScreenDefaultTabFormat")
]
invoice_time_tab_format: Annotated[Literal["SummaryList", "DetailList"] | None, Field(alias="invoiceTimeTabFormat")] = None
invoice_time_tab_format: Annotated[
Literal["SummaryList", "DetailList"] | None, Field(alias="invoiceTimeTabFormat")
] = None
invoicing_display_options: Annotated[
Literal["RemainOnInvoicingScreen", "ShowRecentInvoices"], Field(alias="invoicingDisplayOptions")
]
Expand Down
Loading