In [ ]:
import json, requests

# BASE = "http://localhost:3000/" # Local machine
BASE = "http://192.168.99.100:3000/" # Local Docker instance
# BASE = "http://192.168.99.100:8080/cx/v1/" # Agent on Docker

def jprint(data):
    print(json.dumps(data, indent=4))

In [ ]:
# Load sample CX file
with open("galcxStyle2.json") as json_file:
    cx = json.load(json_file)

In [ ]:
# %%timeit -n 10
# From CX to Cytoscape.js JSON
res = requests.post(BASE + "converter/cx2cyjs", json=cx)
cyjsJson = res.json()

jprint(cyjsJson)

In [ ]:
# From CX to SIF
res = requests.post(BASE + "converter/cx2sif", json=cx)
sif = res.content

print(sif.decode("utf-8"))