mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-26 00:46:22 +02:00
Python API implements streaming interfaces (#577)
* Tech spec * Python CLI utilities updated to use the API including streaming features * Added type safety to Python API * Completed missing auth token support in CLI
This commit is contained in:
parent
b957004db9
commit
01aeede78b
53 changed files with 4489 additions and 715 deletions
|
|
@ -9,10 +9,11 @@ import os
|
|||
|
||||
default_metrics_url = "http://localhost:8088/api/metrics"
|
||||
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
||||
|
||||
def dump_status(metrics_url, api_url, flow_id):
|
||||
def dump_status(metrics_url, api_url, flow_id, token=None):
|
||||
|
||||
api = Api(api_url).flow()
|
||||
api = Api(api_url, token=token).flow()
|
||||
|
||||
flow = api.get(flow_id)
|
||||
class_name = flow["class-name"]
|
||||
|
|
@ -77,11 +78,17 @@ def main():
|
|||
help=f'Metrics URL (default: {default_metrics_url})',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-t', '--token',
|
||||
default=default_token,
|
||||
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
||||
dump_status(args.metrics_url, args.api_url, args.flow_id)
|
||||
dump_status(args.metrics_url, args.api_url, args.flow_id, token=args.token)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue