<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Tutorial
Step1:  1. Backend APIs
Graphistry provides a REST upload API, and you can reuse the Python client for more conveniently using it.
Python
Use the PyGraphistry API as in the Analysis tutorial
Instead of plotting, get the plot URL for embedding
Step2:  REST
Sample CURL below
Get API key either from your profile page, or for admins, by generating a new one
Step3:  2. Frontend APIs
Graphistry supports 3 frontend APIs
<ASSISTANT_TASK:>
Python Code:
import graphistry
# To specify Graphistry account & server, use:
# graphistry.register(api=3, username='...', password='...', protocol='https', server='hub.graphistry.com')
# For more options, see https://github.com/graphistry/pygraphistry#configure
Explanation: Tutorial: Graphistry for Develpers
Start by generating interactive graphs in the Analysis tutorial
Graphistry is a client/server system:
Graphs are akin to live documents: they are created on the server (a dataset), and then users can interact with them
Uploads may provide some settings
Users may dynamically create settings, such as filters: these are workbooks. Multiple workbooks may reuse the same dataset
APIs:
Backend APIs
Python
REST
Frontend APIs
iframe
React
JavaScript
End of explanation
edges = [{'src': 0, 'dst': 1}, {'src': 1, 'dst': 0}]
g = graphistry.edges(pd.DataFrame(edges)).bind(source='src', destination='dst').settings(url_params={'play': 1000})
url = g.plot(render=False)
url
Explanation: 1. Backend APIs
Graphistry provides a REST upload API, and you can reuse the Python client for more conveniently using it.
Python
Use the PyGraphistry API as in the Analysis tutorial
Instead of plotting, get the plot URL for embedding
End of explanation
json_data = {
    "name": "myUniqueGraphName",
    "type": "edgelist",
    "bindings": {
        "sourceField": "src",
        "destinationField": "dst",
        "idField": "node"
    },
    "graph": [
      {"src": "myNode1", "dst": "myNode2",
       "myEdgeField1": "I'm an edge!", "myCount": 7},
      {"src": "myNode2", "dst": "myNode3",
        "myEdgeField1": "I'm also an edge!", "myCount": 200}
    ],
    "labels": [
      {"node": "myNode1",
       "myNodeField1": "I'm a node!",
       "pointColor": 5},
      {"node": "myNode2",
       "myNodeField1": "I'm a node too!",
       "pointColor": 4},
      {"node": "myNode3",
       "myNodeField1": "I'm a node three!",
       "pointColor": 4}
    ]
}
import json
with open('./data/samplegraph.json', 'w') as outfile:  
    json.dump(json_data, outfile)
! curl -H "Content-type: application/json" -X POST -d @./data/samplegraph.json https://labs.graphistry.com/etl?key=YOUR_API_KEY_HERE
Explanation: REST
Sample CURL below
Get API key either from your profile page, or for admins, by generating a new one
End of explanation
from IPython.display import HTML, display
#skip splash screen
url = url.replace('splashAfter', 'zzz')
display(HTML('<iframe src="' + url + '" style="width: 100%; height: 400px"></iframe>'))
Explanation: 2. Frontend APIs
Graphistry supports 3 frontend APIs: iframe, React, and JavaScript
iframe
End of explanation
<END_TASK>