Coverage for skema/skema_py/jan_2023_script.py: 0%

16 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1#!/usr/bin/env python 

2 

3"""Example Python client program to communicate with the SKEMA services and get 

4pyacsets. 

5 

6Originally developed for the Jan 2023 ASKEM Hackathon/PI meeting/evaluation. 

7""" 

8 

9import os 

10import json 

11from requests import get, post, delete 

12import argparse 

13 

14 

15if __name__ == "__main__": 

16 with open("11c--Gromet-FN-manual-dynamics.json") as f: 

17 r = post(f"http://localhost:8080/models", json=json.load(f)) 

18 MODEL_ID = r.text 

19 

20 # Get opis and opos 

21 request_url = f"http://localhost:8080/models/{MODEL_ID}/named_ports" 

22 named_ports = get(request_url).json() 

23 print(named_ports) 

24 

25 # Get other thing 

26 request_url = f"http://localhost:8001/get-pyacset" 

27 r = post(request_url, json=named_ports) 

28 print(r.json()) 

29 

30 # Delete the model so we don't waste space 

31 delete(f"http://localhost:8080/models/{MODEL_ID}")