Skip to content

Commit

Permalink
To fix errors such as googleapis#257, we now default to UTC when no t…
Browse files Browse the repository at this point in the history
…imezone can be found.
  • Loading branch information
Alejandro Casanovas committed Jun 6, 2019
1 parent e2a9023 commit ad061bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion O365/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from requests_oauthlib import OAuth2Session
from stringcase import pascalcase, camelcase, snakecase
from tzlocal import get_localzone
from pytz import UnknownTimeZoneError, UTC

from .utils import ME_RESOURCE, BaseTokenBackend, FileSystemTokenBackend, Token

Expand Down Expand Up @@ -92,7 +93,11 @@ def __init__(self, *, protocol_url=None, api_version=None,
self.default_resource = default_resource
self.use_default_casing = True if casing_function is None else False
self.casing_function = casing_function or camelcase
self.timezone = timezone or get_localzone() # pytz timezone
try:
self.timezone = timezone or get_localzone() # pytz timezone
except UnknownTimeZoneError as e:
log.info('Timezone not provided and the local timezone could not be found. Default to UTC.')
self.timezone = UTC # pytz.timezone('UTC')
self.max_top_value = 500 # Max $top parameter value

# define any keyword that can be different in this protocol
Expand Down

0 comments on commit ad061bc

Please sign in to comment.