Skip to content

Commit

Permalink
Revert "feat: remove pytz usage due to updated O365 lib release (#58)" (
Browse files Browse the repository at this point in the history
#59)

This reverts commit 45477fa.
  • Loading branch information
MShekow authored Oct 7, 2023
1 parent 45477fa commit 72427ad
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import List, Optional, Dict, Any, Tuple

import marshmallow_dataclass
import pytz
import typer
from O365 import Account
from O365.calendar import Schedule, Calendar, Event
Expand Down Expand Up @@ -60,8 +61,11 @@ def authenticate(self) -> Optional[Dict[str, Any]]:
def check_connection_and_credentials(self):
if not self._outlook_configuration:
raise ValueError("Cannot check connection, Outlook configuration is missing")
# Note: we set the "timezone=pytz.UTC" argument only to avoid PytzUsageWarning that point to
# https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
# The issue is known (https://github.com/O365/python-o365/issues/753) but unlikely to be fixed soon
self._account = Account(str(self._outlook_configuration.client_id), auth_flow_type="public",
token_backend=self._backend,
token_backend=self._backend, timezone=pytz.UTC,
tenant_id=self._outlook_configuration.tenant_id or OUTLOOK365_OAUTH_COMMON_TENANT)
if not self._account.is_authenticated:
raise RuntimeError("Unable to load auth token")
Expand Down

0 comments on commit 72427ad

Please sign in to comment.