Closed prose-leviathan closed 2 months ago
Did you run the pytests as I see the following fail?
FAILED src/tests/unit/platform/test_alertsv6_api.py::test_query_basealert_with_create_time_as_start_end - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2023-09-19T12:34:56 is a <class 'str'>. End time 2023-09-20T12:00:12 is a <class 'str'>.
FAILED src/tests/unit/platform/test_alertsv6_api.py::test_query_basealert_with_create_time_as_start_end_as_objs - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2024-07-09T15:36:24.447549 is a <class 'str'>. End time 2024-07-09T15:36:24.447549 is...
FAILED src/tests/unit/platform/test_alertsv7_api.py::test_time_range_formatting[2023-10-03T08:46:52.302222+00:00-2023-10-07T08:46:52.302222+00:00-time_filter0] - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2023-10-03T08:46:52.302222+00:00 is a <class 'str'>. End time 2023-10-07T08:46:52.302...
FAILED src/tests/unit/platform/test_alertsv7_api.py::test_time_range_formatting[2023-10-03T08:46:52.302222Z-2023-10-07T08:46:52.302222Z-time_filter1] - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2023-10-03T08:46:52.302222Z is a <class 'str'>. End time 2023-10-07T08:46:52.302222Z ...
FAILED src/tests/unit/platform/test_alertsv7_api.py::test_time_range_formatting[2023-10-03T08:46:52.302Z-2023-10-07T08:46:52.302Z-time_filter2] - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2023-10-03T08:46:52.302Z is a <class 'str'>. End time 2023-10-07T08:46:52.302Z is a <...
FAILED src/tests/unit/platform/test_alertsv7_v6_compatibility.py::test_set_create_time - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2023-09-19T21:00:00 is a <class 'str'>. End time 2023-09-20T01:00:00 is a <class 'str'>.
FAILED src/tests/unit/platform/test_audit.py::test_search_audit_logs_with_all_bells_and_whistles - cbc_sdk.errors.ApiError: Start and end time must be a string in ISO 8601 format or an object of datetime. Start time 2024-03-01T00:00:00 is a <class 'str'>. End time 2024-03-31T22:00:00 is a <class 'str'>.
~After diving into these errors I recall that the python 3.11 function for fromisoformat
is very limiting in what it supports which is why the backport was necessary for all versions given this broke the wider range of iso formats that exist~
Nevermind it was calling the wrong function. Testing further
Closing as duplicate of https://github.com/carbonblack/carbon-black-cloud-sdk-python/pull/523
Pull request checklist
Please check if your PR fulfills the following requirements:
What is the ticket or issue number?
520
Pull Request Description
This is an implementation of a conditional
backports._datetime_fromisoformat
depedency based on the python version. TheMonkeyPatch
method is the default usage recommended on https://github.com/movermeyer/backports.datetime_fromisoformatDoes this introduce a breaking change?
Should be transparent to user before and after 3.11, as
backports._datetime_fromisoformat
backports thedatetime.fromisoformat
functionality identically. Would simplify installation process by removing the need of a C compiler on the machine for engineers using python 3.11 or 3.12.How Has This Been Tested?
Only minimal tests done to ensure implementation worked. May need further evaluation.