Skip to content

Commit 63ea756

Browse files
author
Sameera Salameh
committed
get transaction results and metadata - cleanup
1 parent 993ea4b commit 63ea756

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

examples/get_transaction_results.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@
2323
def run(id: str, profile: str):
2424
cfg = config.read(profile=profile)
2525
ctx = api.Context(**cfg)
26-
rsp = api.get_transaction_results(ctx, id)
27-
print("Results:")
28-
print(json.dumps(rsp, indent=2))
29-
30-
rsp = api.get_transaction_problems(ctx, id)
31-
print("\nProblems:")
32-
print(json.dumps(rsp, indent=2))
26+
rsp = api.get_transaction_results_and_problems(ctx, id)
27+
show.results(rsp, "wire")
3328

3429

3530
if __name__ == "__main__":

railib/api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ class Permission(str, Enum):
118118
"get_oauth_client",
119119
"get_transaction",
120120
"get_transaction_metadata",
121-
"get_transaction_results",
121+
"list_transactions",
122+
"get_transaction_results_and_problems",
122123
"cancel_transaction",
123124
"get_user",
124125
"list_databases",
@@ -319,6 +320,12 @@ def get_transaction_results(ctx: Context, id: str) -> list:
319320
raise Exception("invalid response type")
320321
return _parse_multipart(content_type, rsp.read())
321322

323+
# When problems are part of the results relations, this function should be deprecated, get_transaction_results should be called instead
324+
def get_transaction_results_and_problems(ctx: Context, id: str) -> list:
325+
rsp = []
326+
rsp.append(get_transaction_problems(ctx, id))
327+
rsp.append(get_transaction_results(ctx, id))
328+
return rsp
322329

323330
def cancel_transaction(ctx: Context, id: str) -> dict:
324331
rsp = rest.post(ctx, _mkurl(ctx, f"{PATH_TRANSACTIONS}/{id}/cancel"), {})

0 commit comments

Comments
 (0)