How Do I Construct Typed Constants For The Onenote Com Api In Python?
I want to use the UpdatePageContent COM method documentation via the python win32com module. Things I can do so far include getting the hierarchy, getting page contents, etc. I can
Solution 1:
This question is old in the meantime, but nonetheless I want to show a working solution, which I found while trying to acheive something similar. The problem is that you need a timezone-aware date in order to call astimezone()
on it, which is what the API does for some reason. To make a timezone-aware date, you have to localize it first. For example, you could modify your code as follows:
import datetime
import pytz
...
date= pytz.utc.localize(datetime.datetime(year=1899, month=12, day=30))
oneNoteApp.UpdatePageContent(soup, date)
The actual problem is coming up with a suitable date to pass to to UpdatePageContent()
. The weird choice in my answer is detailed here.
Post a Comment for "How Do I Construct Typed Constants For The Onenote Com Api In Python?"