O365 / python-o365

A simple python library to interact with Microsoft Graph and Office 365 API
Apache License 2.0
1.65k stars 419 forks source link

default to utc if no timezone is set #1078

Closed dekiesel closed 4 months ago

dekiesel commented 4 months ago

Fixes #1077

dekiesel commented 4 months ago
(.venv) d@lap:~/pull_requests/python-o365$ pytest tests/test_connection.py 
=================================================== test session starts ===================================================
platform linux -- Python 3.12.3, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/d/pull_requests/python-o365
collected 1 item                                                                                                          

tests/test_connection.py .                                                                                          [100%]

==================================================== 1 passed in 0.18s ====================================================
alejcas commented 4 months ago

I don't understand what's the problem here, but I think the fix here is not appropiate (or maybe the tittle of the PR is incorrect).

The current implementation already defaults to UTC:

# get_localzone() from tzlocal will try to get the system local timezone and if not will return UTC

https://github.com/O365/python-o365/blob/master/O365/connection.py#L104

I'll continue on the issue...