Conversation
* Fix test: Add approve_action for backwards compatibility (no-op) - Added approve_action() method to Antigena class - This method returns dummy success response for backwards compatibility - Modern Darktrace versions replaced approve/decline workflow with direct action methods - Fixes test_antigena_actions test failure * Security: Enable SSL verification by default - Add verify_ssl parameter to DarktraceClient (default: True) - All 28 endpoint modules now use self.client.verify_ssl - Update documentation with SSL verification guidance - Remove urllib3.disable_warnings from examples Closes #47 --------- Co-authored-by: LegendEvent <lpaulmann@example.com>
* feat: add configurable request timeout support - Add timeout parameter to DarktraceClient (default: None for backwards compatibility) - Add per-request timeout override to all endpoint methods - Support tuple format: timeout=(connect_timeout, read_timeout) - Add TimeoutType export for type hints - Add comprehensive test suite (11 tests) - Update README and docs with timeout documentation This enables users to: - Set client-wide timeout: DarktraceClient(timeout=30) - Override per-request: client.advanced_search.search(query, timeout=600) - Use granular timeouts: timeout=(5, 30) for connect/read * fix: use sentinel pattern for timeout to allow None override - Add _UNSET sentinel to distinguish 'not provided' from 'None' - timeout=None now disables timeout (no timeout) - timeout not provided uses client default - Remove unused Union/Tuple imports from client.py - Update tests and documentation Addresses Copilot PR review comments #1 and #2 * feat: add request timing to debug output (closes #50) Add timing information to debug output for all API requests: - New _format_timing() function formats elapsed time as [123ms] or [1.50s] - New _make_request() method in BaseEndpoint logs timing when debug=True - Zero overhead when debug=False (timing only calculated when needed) - All 27 endpoint modules updated to use _make_request() Timing format: DEBUG: GET https://instance.dt/endpoint [123ms] * docs: remove timeout documentation from README, delete test_timeout.py * docs: add BREAKING CHANGE warning for verify_ssl default switch⚠️ BREAKING CHANGE: verify_ssl default changed from False to True in v0.8.56 Users with self-signed certificates must either: 1. Add certificate to system trust store, OR 2. Set verify_ssl=False explicitly - Update README.md with breaking change notice - Update docs/README.md with breaking change warning - Remove timeout documentation (not relevant for most users) * docs: add BREAKING CHANGE warning to all 28 module docs⚠️ BREAKING CHANGE: verify_ssl default changed from False to True in v0.8.56 Updated all module documentation files in docs/modules/ with the breaking change warning for SSL verification default switch.
* feat: add reliability improvements and error handling enhancements - Add connection pooling via requests.Session() for better performance - Add context manager support (__enter__/__exit__/close) for proper resource cleanup - Add automatic retry logic (3 retries, 10s wait) for transient failures (5xx, 429, connection errors) - Add URL scheme validation to block dangerous schemes (file://, ftp://, data://) while allowing private IPs for enterprise deployments - Add _safe_json() helper method for JSON response parsing with error handling - Fix error handling in ModelBreaches to re-raise exceptions instead of returning error dicts - Fix IntelFeed parameter name (fulldetails not full_details) in examples and tests - Update SSL warning suppression to follow SDK's verify_ssl default - Clean up unused imports and translate comments to English * fix: address copilot review comments - Remove unreachable code after raise statements in dt_breaches.py - Fix duplicate imports and ordering in client.py - Remove duplicate SSL warning suppression in conftest.py
## Added - Connection pooling via requests.Session() for 4x faster requests - Context manager support (with DarktraceClient(...) as client) - Automatic retry logic (3 retries, 10s wait for transient failures) - SSRF protection (blocks dangerous URL schemes, allows private IPs) - Configurable request timeout parameter - CHANGELOG.md - tests/test_compilation.py - Full SDK compilation test - tests/test_sdk_readonly.py - Comprehensive read-only test (moved from root) ## Changed - SSL verification now enabled by default (verify_ssl=True) - ModelBreaches methods re-raise exceptions instead of returning error dicts - Fixed IntelFeed fulldetails parameter name in examples - Updated docs/README.md with v0.9.0 features ## Removed - tests/test_devicesearch.py (mocked test replaced by compilation + readonly tests) ## Test Suite - tests/test_compilation.py - 9 tests, no network required - tests/test_sdk_readonly.py - 62 tests against real Darktrace instance
There was a problem hiding this comment.
Pull request overview
This pull request introduces v0.9.0 of the Darktrace SDK, a significant release focused on reliability, performance, and security improvements. The release adds connection pooling with requests.Session(), context manager support for resource cleanup, automatic retry logic for transient failures, SSRF protection through URL scheme validation, and configurable timeouts. A major breaking change is that SSL verification is now enabled by default.
Changes:
- Infrastructure improvements: Connection pooling, context manager support, retry logic (3 retries with 10s wait for 5xx/429/connection errors), SSRF protection, and configurable timeouts
- Security enhancement: SSL verification enabled by default (breaking change)
- Error handling: ModelBreaches methods now re-raise exceptions instead of returning error dicts
- Bug fix: Corrected IntelFeed parameter from
full_detailstofulldetails - Testing: Added compilation test suite (
test_compilation.py) and moved/updated readonly integration tests - Documentation: Updated for v0.9.0 features with SSL verification guidance
Reviewed changes
Copilot reviewed 74 out of 75 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| darktrace/_version.py | Version bump from 0.8.55 to 0.9.0 |
| darktrace/client.py | Added session management, context manager support, SSRF validation, timeout parameter, and verify_ssl default changed to True |
| darktrace/dt_utils.py | Added retry logic via _make_request(), timeout resolution via _resolve_timeout(), timing formatter, and unused _safe_json() helper |
| darktrace/auth.py | Translated German comment to English |
| darktrace/dt_*.py (27 modules) | Added timeout parameter to all methods with proper type hints and _UNSET default (with one exception in dt_antigena.py) |
| darktrace/dt_breaches.py | Changed error handling to re-raise exceptions instead of returning error dicts |
| darktrace/dt_intelfeed.py | Fixed get_with_details() to use correct fulldetails parameter |
| darktrace/dt_antigena.py | Added backwards-compatible no-op approve_action() method |
| tests/test_compilation.py | New comprehensive SDK structure validation test (9 tests, no network required) |
| tests/test_sdk_readonly.py | Updated with correct fulldetails parameter and changed device IDs from 4336 to 1 |
| tests/test_devicesearch.py | Removed (mocked test replaced by compilation + readonly tests) |
| conftest.py | Modified SSL warning suppression logic (but references undefined option) |
| examples/*.py | Updated to use correct fulldetails parameter and removed urllib3 warning suppression |
| docs/README.md | Added v0.9.0 feature documentation and client options table |
| docs/modules/*.md | Added breaking change warning banner to all module docs |
| CHANGELOG.md | New file documenting all v0.9.0 changes |
| README.md | Updated with v0.9.0 features, SSL verification guidance, and certificate installation instructions |
| .gitignore | Added entries for certificates, Python build artifacts, and agent knowledge base files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1. dt_intelfeed.py: Add timeout parameter to convenience methods - get_sources(), get_by_source(), get_with_details() now accept timeout 2. dt_antigena.py: Fix timeout default consistency - activate_action() now uses _UNSET instead of None 3. dt_antigena.py: Add deprecation warning to approve_action() - Now emits DeprecationWarning pointing to activate_action() 4. dt_utils.py: Remove unused _safe_json() method 5. docs/README.md: Fix version number and remove duplicate warning - v0.8.56 -> v0.9.0 - Removed duplicate breaking change warning 6. docs/modules/*.md: Fix version number - All module docs now correctly say v0.9.0
The to+hours parameter combination with eventtype may not be supported on all Darktrace versions. Wrap in try/except to handle gracefully.
- Try multiple endpoints (/status, /devices, /network) for connection validation - Some Darktrace versions may not support /status endpoint - Handle eventtype parameter gracefully (not supported on all versions) - Add better error reporting with response body
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 74 out of 75 changed files in this pull request and generated 10 comments.
Comments suppressed due to low confidence (4)
tests/test_sdk_readonly.py:38
TEST_VERIFY_SSLis computed from--no-verify, but it's never passed intoDarktraceClient(...). Since the client now defaults toverify_ssl=True, running tests with--no-verifywill still perform certificate verification (and may fail against self-signed certs). Passverify_ssl=TEST_VERIFY_SSLwhen constructing the client (and similarly propagatedebugif intended).
tests/test_sdk_readonly.py:505- This "non-existent did" edge case is currently calling
/devicesummarywith the samedid=1used in the earlier happy-path checks, so it isn't actually testing a non-existent device ID. Use a clearly invalid DID (e.g., a very large number) or derive an unused DID based on existing device IDs to make this test meaningful.
tests/test_sdk_readonly.py:58 - The connection fallback check assumes
client.devices.get(count=1)returns alist, but the SDK's/deviceswrapper returnsresponse.json()which can be adict(and this same test file already handles both shapes later). This can cause false negatives in the connectivity check. Consider accepting(list, dict)and/or checking for expected keys likedeviceswhen a dict is returned.
tests/test_sdk_readonly.py:1242 - Duplicate section header:
# --- tags module tests (#26) ---appears twice in a row. Remove one to avoid confusion and keep the test file tidy.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
- Changed from fixed 10s wait to exponential backoff - Initial wait: 3s, then 6s, 12s for subsequent retries - Updated debug messages to show wait time - Updated test to check _INITIAL_RETRY_WAIT_SECONDS == 3
The retry loop was sleeping but immediately returning without retrying. Adding continue ensures the loop iterates and makes a new request.
- SSRF protection tests (9 tests) - Context manager tests (3 tests) - Retry logic tests (5 tests) - Timeout handling tests (5 tests) - All 28 endpoint signature tests (31 tests) - Endpoint mock call tests (31 tests) - Retry configuration tests (3 tests) - SSL verification tests (2 tests) - Deprecation tests (1 test) Total: 90 tests, all passed
Changed _RETRY_WAIT_SECONDS to _INITIAL_RETRY_WAIT_SECONDS to match the constant rename in dt_utils.py
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 75 out of 76 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (5)
tests/test_sdk_readonly.py:1242
- The section header comment for the tags tests is duplicated back-to-back. Please remove one copy to keep the test file tidy.
darktrace/dt_devices.py:28 Devices.get()docstring starts with "Update a single device", but this method performs a GET to retrieve device information. Please update the docstring/return description to match the actual behavior (and keep update semantics inDevices.update()).
"""
Update a single device.
tests/test_sdk_readonly.py:505
- The "Edge case: non-existent did" test still calls
dt_client.devicesummary.get(did=1), which is the same id used for the earlier "known device" assertions. This doesn't test the intended edge case anymore; use an invalid/non-existent did (e.g., a large number) or derive one dynamically.
tests/test_sdk_readonly.py:38 dt_clientcomputesTEST_VERIFY_SSL = not --no-verifyand disables urllib3 warnings when verification is off, but it never passesverify_ssl=TEST_VERIFY_SSLintoDarktraceClient(...). As a result,--no-verifywon't actually disable SSL verification and these tests can still fail against self-signed instances.
tests/test_sdk_readonly.py:58- In the connection check fallback,
client.devices.get(count=1)is treated as successful only when the response is alist, but/devicescommonly returns adict(e.g., with adeviceskey). This can cause false negatives and fail the fixture even when connectivity/auth are fine; consider accepting either dict or list (or just treat any successful response as OK).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
- Fix timeout parameter default from None to _UNSET in 6 endpoint files (tags, status, network, endpointdetails, subnets, summarystatistics) This ensures DarktraceClient(timeout=...) is properly inherited - Update documentation to match actual retry implementation Change from "10s wait" to "exponential backoff (3s, 6s, 12s)" across CHANGELOG.md, README.md, docs/README.md - Remove incorrect CHANGELOG entry Delete false _safe_json() helper claim (method doesn't exist) - Fix endpoint module count Change from 28 to 27 in CHANGELOG.md and test_mock.py - Fix breaking change version in docs Change v0.8.56 to v0.9.0 in docs/README.md - Remove duplicate SSL Verification section from docs/README.md - Add response.close() before retry to prevent connection pool exhaustion - Previous test fixes (verify_ssl, connection check, non-existent did, docstring)
* Security: Enable SSL certificate verification by default (#48) * Fix test: Add approve_action for backwards compatibility (no-op) - Added approve_action() method to Antigena class - This method returns dummy success response for backwards compatibility - Modern Darktrace versions replaced approve/decline workflow with direct action methods - Fixes test_antigena_actions test failure * Security: Enable SSL verification by default - Add verify_ssl parameter to DarktraceClient (default: True) - All 28 endpoint modules now use self.client.verify_ssl - Update documentation with SSL verification guidance - Remove urllib3.disable_warnings from examples Closes #47 --------- Co-authored-by: LegendEvent <lpaulmann@example.com> * feat: add configurable request timeout support (#49) * feat: add configurable request timeout support - Add timeout parameter to DarktraceClient (default: None for backwards compatibility) - Add per-request timeout override to all endpoint methods - Support tuple format: timeout=(connect_timeout, read_timeout) - Add TimeoutType export for type hints - Add comprehensive test suite (11 tests) - Update README and docs with timeout documentation This enables users to: - Set client-wide timeout: DarktraceClient(timeout=30) - Override per-request: client.advanced_search.search(query, timeout=600) - Use granular timeouts: timeout=(5, 30) for connect/read * fix: use sentinel pattern for timeout to allow None override - Add _UNSET sentinel to distinguish 'not provided' from 'None' - timeout=None now disables timeout (no timeout) - timeout not provided uses client default - Remove unused Union/Tuple imports from client.py - Update tests and documentation Addresses Copilot PR review comments #1 and #2 * feat: add request timing to debug output (closes #50) Add timing information to debug output for all API requests: - New _format_timing() function formats elapsed time as [123ms] or [1.50s] - New _make_request() method in BaseEndpoint logs timing when debug=True - Zero overhead when debug=False (timing only calculated when needed) - All 27 endpoint modules updated to use _make_request() Timing format: DEBUG: GET https://instance.dt/endpoint [123ms] * docs: remove timeout documentation from README, delete test_timeout.py * docs: add BREAKING CHANGE warning for verify_ssl default switch⚠️ BREAKING CHANGE: verify_ssl default changed from False to True in v0.8.56 Users with self-signed certificates must either: 1. Add certificate to system trust store, OR 2. Set verify_ssl=False explicitly - Update README.md with breaking change notice - Update docs/README.md with breaking change warning - Remove timeout documentation (not relevant for most users) * docs: add BREAKING CHANGE warning to all 28 module docs⚠️ BREAKING CHANGE: verify_ssl default changed from False to True in v0.8.56 Updated all module documentation files in docs/modules/ with the breaking change warning for SSL verification default switch. * feat: add reliability improvements and error handling enhancements (#51) * feat: add reliability improvements and error handling enhancements - Add connection pooling via requests.Session() for better performance - Add context manager support (__enter__/__exit__/close) for proper resource cleanup - Add automatic retry logic (3 retries, 10s wait) for transient failures (5xx, 429, connection errors) - Add URL scheme validation to block dangerous schemes (file://, ftp://, data://) while allowing private IPs for enterprise deployments - Add _safe_json() helper method for JSON response parsing with error handling - Fix error handling in ModelBreaches to re-raise exceptions instead of returning error dicts - Fix IntelFeed parameter name (fulldetails not full_details) in examples and tests - Update SSL warning suppression to follow SDK's verify_ssl default - Clean up unused imports and translate comments to English * fix: address copilot review comments - Remove unreachable code after raise statements in dt_breaches.py - Fix duplicate imports and ordering in client.py - Remove duplicate SSL warning suppression in conftest.py * release: v0.9.0 ## Added - Connection pooling via requests.Session() for 4x faster requests - Context manager support (with DarktraceClient(...) as client) - Automatic retry logic (3 retries, 10s wait for transient failures) - SSRF protection (blocks dangerous URL schemes, allows private IPs) - Configurable request timeout parameter - CHANGELOG.md - tests/test_compilation.py - Full SDK compilation test - tests/test_sdk_readonly.py - Comprehensive read-only test (moved from root) ## Changed - SSL verification now enabled by default (verify_ssl=True) - ModelBreaches methods re-raise exceptions instead of returning error dicts - Fixed IntelFeed fulldetails parameter name in examples - Updated docs/README.md with v0.9.0 features ## Removed - tests/test_devicesearch.py (mocked test replaced by compilation + readonly tests) ## Test Suite - tests/test_compilation.py - 9 tests, no network required - tests/test_sdk_readonly.py - 62 tests against real Darktrace instance * fix: address Copilot review comments 1. dt_intelfeed.py: Add timeout parameter to convenience methods - get_sources(), get_by_source(), get_with_details() now accept timeout 2. dt_antigena.py: Fix timeout default consistency - activate_action() now uses _UNSET instead of None 3. dt_antigena.py: Add deprecation warning to approve_action() - Now emits DeprecationWarning pointing to activate_action() 4. dt_utils.py: Remove unused _safe_json() method 5. docs/README.md: Fix version number and remove duplicate warning - v0.8.56 -> v0.9.0 - Removed duplicate breaking change warning 6. docs/modules/*.md: Fix version number - All module docs now correctly say v0.9.0 * fix: handle 400 error in test_summarystatistics_basic The to+hours parameter combination with eventtype may not be supported on all Darktrace versions. Wrap in try/except to handle gracefully. * fix: improve connection validation in test fixture - Try multiple endpoints (/status, /devices, /network) for connection validation - Some Darktrace versions may not support /status endpoint - Handle eventtype parameter gracefully (not supported on all versions) - Add better error reporting with response body * feat: add exponential backoff for retry logic (3s, 6s, 12s) - Changed from fixed 10s wait to exponential backoff - Initial wait: 3s, then 6s, 12s for subsequent retries - Updated debug messages to show wait time - Updated test to check _INITIAL_RETRY_WAIT_SECONDS == 3 * fix: add continue statement to retry loop The retry loop was sleeping but immediately returning without retrying. Adding continue ensures the loop iterates and makes a new request. * test: add comprehensive mock test suite for all 28 endpoints - SSRF protection tests (9 tests) - Context manager tests (3 tests) - Retry logic tests (5 tests) - Timeout handling tests (5 tests) - All 28 endpoint signature tests (31 tests) - Endpoint mock call tests (31 tests) - Retry configuration tests (3 tests) - SSL verification tests (2 tests) - Deprecation tests (1 test) Total: 90 tests, all passed * fix: update import name in test_compilation Changed _RETRY_WAIT_SECONDS to _INITIAL_RETRY_WAIT_SECONDS to match the constant rename in dt_utils.py * Fix: address GitHub Copilot PR #55 review comments - Fix timeout parameter default from None to _UNSET in 6 endpoint files (tags, status, network, endpointdetails, subnets, summarystatistics) This ensures DarktraceClient(timeout=...) is properly inherited - Update documentation to match actual retry implementation Change from "10s wait" to "exponential backoff (3s, 6s, 12s)" across CHANGELOG.md, README.md, docs/README.md - Remove incorrect CHANGELOG entry Delete false _safe_json() helper claim (method doesn't exist) - Fix endpoint module count Change from 28 to 27 in CHANGELOG.md and test_mock.py - Fix breaking change version in docs Change v0.8.56 to v0.9.0 in docs/README.md - Remove duplicate SSL Verification section from docs/README.md - Add response.close() before retry to prevent connection pool exhaustion - Previous test fixes (verify_ssl, connection check, non-existent did, docstring) --------- Co-authored-by: LegendEvent <lpaulmann@example.com>
* Security: Enable SSL certificate verification by default (#48) * Fix test: Add approve_action for backwards compatibility (no-op) - Added approve_action() method to Antigena class - This method returns dummy success response for backwards compatibility - Modern Darktrace versions replaced approve/decline workflow with direct action methods - Fixes test_antigena_actions test failure * Security: Enable SSL verification by default - Add verify_ssl parameter to DarktraceClient (default: True) - All 28 endpoint modules now use self.client.verify_ssl - Update documentation with SSL verification guidance - Remove urllib3.disable_warnings from examples Closes #47 --------- Co-authored-by: LegendEvent <lpaulmann@example.com> * feat: add configurable request timeout support (#49) * feat: add configurable request timeout support - Add timeout parameter to DarktraceClient (default: None for backwards compatibility) - Add per-request timeout override to all endpoint methods - Support tuple format: timeout=(connect_timeout, read_timeout) - Add TimeoutType export for type hints - Add comprehensive test suite (11 tests) - Update README and docs with timeout documentation This enables users to: - Set client-wide timeout: DarktraceClient(timeout=30) - Override per-request: client.advanced_search.search(query, timeout=600) - Use granular timeouts: timeout=(5, 30) for connect/read * fix: use sentinel pattern for timeout to allow None override - Add _UNSET sentinel to distinguish 'not provided' from 'None' - timeout=None now disables timeout (no timeout) - timeout not provided uses client default - Remove unused Union/Tuple imports from client.py - Update tests and documentation Addresses Copilot PR review comments #1 and #2 * feat: add request timing to debug output (closes #50) Add timing information to debug output for all API requests: - New _format_timing() function formats elapsed time as [123ms] or [1.50s] - New _make_request() method in BaseEndpoint logs timing when debug=True - Zero overhead when debug=False (timing only calculated when needed) - All 27 endpoint modules updated to use _make_request() Timing format: DEBUG: GET https://instance.dt/endpoint [123ms] * docs: remove timeout documentation from README, delete test_timeout.py * docs: add BREAKING CHANGE warning for verify_ssl default switch⚠️ BREAKING CHANGE: verify_ssl default changed from False to True in v0.8.56 Users with self-signed certificates must either: 1. Add certificate to system trust store, OR 2. Set verify_ssl=False explicitly - Update README.md with breaking change notice - Update docs/README.md with breaking change warning - Remove timeout documentation (not relevant for most users) * docs: add BREAKING CHANGE warning to all 28 module docs⚠️ BREAKING CHANGE: verify_ssl default changed from False to True in v0.8.56 Updated all module documentation files in docs/modules/ with the breaking change warning for SSL verification default switch. * feat: add reliability improvements and error handling enhancements (#51) * feat: add reliability improvements and error handling enhancements - Add connection pooling via requests.Session() for better performance - Add context manager support (__enter__/__exit__/close) for proper resource cleanup - Add automatic retry logic (3 retries, 10s wait) for transient failures (5xx, 429, connection errors) - Add URL scheme validation to block dangerous schemes (file://, ftp://, data://) while allowing private IPs for enterprise deployments - Add _safe_json() helper method for JSON response parsing with error handling - Fix error handling in ModelBreaches to re-raise exceptions instead of returning error dicts - Fix IntelFeed parameter name (fulldetails not full_details) in examples and tests - Update SSL warning suppression to follow SDK's verify_ssl default - Clean up unused imports and translate comments to English * fix: address copilot review comments - Remove unreachable code after raise statements in dt_breaches.py - Fix duplicate imports and ordering in client.py - Remove duplicate SSL warning suppression in conftest.py * release: v0.9.0 ## Added - Connection pooling via requests.Session() for 4x faster requests - Context manager support (with DarktraceClient(...) as client) - Automatic retry logic (3 retries, 10s wait for transient failures) - SSRF protection (blocks dangerous URL schemes, allows private IPs) - Configurable request timeout parameter - CHANGELOG.md - tests/test_compilation.py - Full SDK compilation test - tests/test_sdk_readonly.py - Comprehensive read-only test (moved from root) ## Changed - SSL verification now enabled by default (verify_ssl=True) - ModelBreaches methods re-raise exceptions instead of returning error dicts - Fixed IntelFeed fulldetails parameter name in examples - Updated docs/README.md with v0.9.0 features ## Removed - tests/test_devicesearch.py (mocked test replaced by compilation + readonly tests) ## Test Suite - tests/test_compilation.py - 9 tests, no network required - tests/test_sdk_readonly.py - 62 tests against real Darktrace instance * fix: address Copilot review comments 1. dt_intelfeed.py: Add timeout parameter to convenience methods - get_sources(), get_by_source(), get_with_details() now accept timeout 2. dt_antigena.py: Fix timeout default consistency - activate_action() now uses _UNSET instead of None 3. dt_antigena.py: Add deprecation warning to approve_action() - Now emits DeprecationWarning pointing to activate_action() 4. dt_utils.py: Remove unused _safe_json() method 5. docs/README.md: Fix version number and remove duplicate warning - v0.8.56 -> v0.9.0 - Removed duplicate breaking change warning 6. docs/modules/*.md: Fix version number - All module docs now correctly say v0.9.0 * fix: handle 400 error in test_summarystatistics_basic The to+hours parameter combination with eventtype may not be supported on all Darktrace versions. Wrap in try/except to handle gracefully. * fix: improve connection validation in test fixture - Try multiple endpoints (/status, /devices, /network) for connection validation - Some Darktrace versions may not support /status endpoint - Handle eventtype parameter gracefully (not supported on all versions) - Add better error reporting with response body * feat: add exponential backoff for retry logic (3s, 6s, 12s) - Changed from fixed 10s wait to exponential backoff - Initial wait: 3s, then 6s, 12s for subsequent retries - Updated debug messages to show wait time - Updated test to check _INITIAL_RETRY_WAIT_SECONDS == 3 * fix: add continue statement to retry loop The retry loop was sleeping but immediately returning without retrying. Adding continue ensures the loop iterates and makes a new request. * test: add comprehensive mock test suite for all 28 endpoints - SSRF protection tests (9 tests) - Context manager tests (3 tests) - Retry logic tests (5 tests) - Timeout handling tests (5 tests) - All 28 endpoint signature tests (31 tests) - Endpoint mock call tests (31 tests) - Retry configuration tests (3 tests) - SSL verification tests (2 tests) - Deprecation tests (1 test) Total: 90 tests, all passed * fix: update import name in test_compilation Changed _RETRY_WAIT_SECONDS to _INITIAL_RETRY_WAIT_SECONDS to match the constant rename in dt_utils.py * Fix: address GitHub Copilot PR #55 review comments - Fix timeout parameter default from None to _UNSET in 6 endpoint files (tags, status, network, endpointdetails, subnets, summarystatistics) This ensures DarktraceClient(timeout=...) is properly inherited - Update documentation to match actual retry implementation Change from "10s wait" to "exponential backoff (3s, 6s, 12s)" across CHANGELOG.md, README.md, docs/README.md - Remove incorrect CHANGELOG entry Delete false _safe_json() helper claim (method doesn't exist) - Fix endpoint module count Change from 28 to 27 in CHANGELOG.md and test_mock.py - Fix breaking change version in docs Change v0.8.56 to v0.9.0 in docs/README.md - Remove duplicate SSL Verification section from docs/README.md - Add response.close() before retry to prevent connection pool exhaustion - Previous test fixes (verify_ssl, connection check, non-existent did, docstring) --------- Co-authored-by: LegendEvent <lpaulmann@example.com>
Release v0.9.0
Added
requests.Session()for 4x faster requestswith DarktraceClient(...) as client:timeoutparameter onDarktraceClienttests/test_compilation.py(9 tests, no network)tests/test_sdk_readonly.py(62 tests against real instance)Changed
verify_ssl=True)fulldetailsparameterRemoved
tests/test_devicesearch.py(mocked test replaced)Test Suite
tests/test_compilation.pypytest tests/test_compilation.py -vtests/test_sdk_readonly.pypytest tests/test_sdk_readonly.py -v --host=... --public-token=... --private-token=...Files Changed
CHANGELOG.md- AddedREADME.md- Updated with v0.9.0 featuresdarktrace/_version.py- 0.8.55 → 0.9.0docs/README.md- Added v0.9.0 features documentationtests/test_compilation.py- Addedtests/test_sdk_readonly.py- Moved from roottests/test_devicesearch.py- Removed