Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_result method to st2client #6140

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Added
#6118
Contributed by @cognifloyd

* Added a `get_result` method to the `ExecutionResourceManager` Class for st2client
Contributed by @skiedude

3.8.1 - December 13, 2023
-------------------------
Fixed
Expand Down
10 changes: 10 additions & 0 deletions st2client/st2client/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,16 @@ def get_output(self, execution_id, output_type=None, **kwargs):

return response.text

@add_auth_token_to_kwargs_from_env
def get_result(self, execution_id, **kwargs):
url = "/%s/%s/result" % (self.resource.get_url_path_name(), execution_id)

response = self.client.get(url, **kwargs)
if response.status_code != http_client.OK:
self.handle_error(response)

return orjson.loads(response.text)
skiedude marked this conversation as resolved.
Show resolved Hide resolved

@add_auth_token_to_kwargs_from_env
def pause(self, execution_id, **kwargs):
url = "/%s/%s" % (self.resource.get_url_path_name(), execution_id)
Expand Down