datetime.strptime("2022-04-27T19:39:14.856697021Z", "%Y-%m-%dT%H:%M:%S.%f%z")
2022-05-01T10:13:27.648823745+03:00
, на сколько я понимаю они не отличаютсяTraceback (most recent call last):
File "C:\Users\MrSha\Documents\Projects\fastpanel-api\main.py", line 14, in <module>
asyncio.run(main())
File "C:\Users\MrSha\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\MrSha\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "C:\Users\MrSha\Documents\Projects\fastpanel-api\main.py", line 9, in main
result = await panel.domains.get_list()
File "C:\Users\MrSha\Documents\Projects\fastpanel-api\fastpanel_api\domains.py", line 44, in get_list
created_at=datetime.strptime(domain["created_at"], "%Y-%m-%dT%H:%M:%S.%f%z"),
File "C:\Users\MrSha\AppData\Local\Programs\Python\Python310\lib\_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "C:\Users\MrSha\AppData\Local\Programs\Python\Python310\lib\_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2022-04-27T19:39:14.856697021Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'
%f
принимает значение от 1 до 6 символов, и это та причина, по которой вы получаете ошибку.datetime.strptime("2022-04-27T19:39:14.856697+03:00", "%Y-%m-%dT%H:%M:%S.%f%z")
>> 2022-04-27 19:39:14.856970+03:00
datetime.strptime("2022-04-27T19:39:14.856697Z", "%Y-%m-%dT%H:%M:%S.%f%z")
>> 2022-04-27 19:39:14.856697+00:00
dateutil.parser
.import dateutil.parser as dparser
print("{}".format(dparser.parse("2022-04-27T19:39:14.856697021Z", fuzzy=True)))
>> 2022-04-27 19:39:14.856697+00:00