from N2G import drawio_diagram
import requests
diagram = drawio_diagram()
diagram.add_diagram("Page-1")
diagram.add_node(id="R1")
diagram.add_node(id="R2")
diagram.add_link("R1", "R2", label="DF", src_label="Gi1/1", trgt_label="GE23")
diagram.layout(algo="kk")
diagram.dump_file(filename="Sample_graph.drawio", folder="./Output/")
data = {
'type': 'page',
'title': 'test',
'version': {'number': 1 + 1},
'body': {
'storage': {
'value': '',
'representation': 'storage'
}
}
}
headers = {"X-Atlassian-Token": "nocheck"}
files = {'file': ('./Output/Sample_graph.drawio', open('./Output/Sample_graph.drawio', 'rb'), 'application/vnd.jgraph.mxfile')}
requests.post(url+'/child/attachment', data=data, auth=('id', 'password'), files=files, headers=headers, verify=False)