feat: add async get_events_export() to AsyncERClient (ERA-12670)#33
Open
JoshuaVulcan wants to merge 4 commits intomainfrom
Open
feat: add async get_events_export() to AsyncERClient (ERA-12670)#33JoshuaVulcan wants to merge 4 commits intomainfrom
JoshuaVulcan wants to merge 4 commits intomainfrom
Conversation
Add get_events_export(filter=None) to AsyncERClient for parity with the existing sync method. Because the endpoint returns a CSV file rather than JSON, a new _get_raw() helper is introduced that returns the raw httpx.Response without attempting JSON parsing while preserving the standard error-handling pipeline. Also adds comprehensive tests for both the sync and async get_events_export() methods covering success, filter forwarding, URL construction, and error cases (401, 403, 404, 500). Co-authored-by: Cursor <cursoragent@cursor.com>
JoshuaVulcan
added a commit
that referenced
this pull request
Feb 11, 2026
Use _get_raw (from PR #33) for raw GET responses instead of adding _get_response; rebased onto ERA-12670/async-events-export. Co-authored-by: Cursor <cursoragent@cursor.com>
# Conflicts: # tests/sync_client/conftest.py
… main async helpers; fix events export test URLs Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds get_events_export(filter=None) to AsyncERClient to achieve parity with the existing sync method. The endpoint returns CSV data, so a new _get_raw() helper method is introduced to bypass JSON parsing while maintaining consistent error handling. The PR also refactors the async _delete method to delegate to _call instead of having its own inline implementation, and adds comprehensive tests for both sync and async versions.
Changes:
- Added
_get_raw()andget_events_export()methods toAsyncERClient, and refactored_deleteto delegate to_call - Added 9 async tests covering success, filter forwarding, content-type, and error cases (401/403/404/500)
- Added 9 sync tests for the pre-existing
get_events_export()method
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
erclient/client.py |
Added get_events_export() and _get_raw() to AsyncERClient; refactored _delete to delegate to _call |
tests/async_client/test_get_events_export.py |
New async test file with 9 tests for the export endpoint |
tests/sync_client/test_get_events_export.py |
New sync test file with 9 tests for the existing export method |
💡 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.
Comment on lines
+1690
to
+1701
| self.logger.error( | ||
| 'Request to ER failed', | ||
| extra=dict( | ||
| provider_key=self.provider_key, | ||
| service=self.service_root, | ||
| path=path, | ||
| status_code=None, | ||
| reason=reason, | ||
| text="", | ||
| ), | ||
| ) | ||
| raise ERClientException(f'Request to ER failed: {reason}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_events_export(filter=None)toAsyncERClient, achieving parity with the existing sync method._get_raw()helper onAsyncERClientthat returns the rawhttpx.Responsewithout JSON parsing, suitable for file-download endpoints (CSV export).get_events_export()covering success, filter forwarding, URL construction, content-type verification, and error handling (401/403/404/500).Details
The das
activity/events/exportendpoint returns a CSV file. The sync client already supports this viareturn_response=Truein its_get(). The async_call()always parses JSON, so a new_get_raw()method was needed to bypass that while preserving the standard error-handling pipeline (_handle_http_status_error).Changes
erclient/client.py— added_get_raw()andget_events_export()toAsyncERClienttests/async_client/test_get_events_export.py— 9 async teststests/sync_client/test_get_events_export.py— 9 sync tests (new coverage for the pre-existing sync method)tests/sync_client/conftest.py— sync test fixturesTest plan
python3 -m pytest -v)Jira: ERA-12670