Skip to content

Instantly share code, notes, and snippets.

@tomas-wood
Created October 16, 2018 17:46
Show Gist options
  • Save tomas-wood/035f02b2e7c303efc0bc9c90ebe914bb to your computer and use it in GitHub Desktop.
Save tomas-wood/035f02b2e7c303efc0bc9c90ebe914bb to your computer and use it in GitHub Desktop.
GES API`
import urllib3
http = urllib3.PoolManager()
with open('token', 'r') as f:
token = f.read()
# Headers are the way we pass through the token.
headers = {}
headers['Content-Type'] = 'application/json'
headers['X-Auth-Token'] = token
headers['X-Language'] = 'en-us'
my_project_id = "bb4478f419c34cd7889b0ab8639e81e6"
my_graph_name = "ges_abfe"
base = "ges.cn-north-1.myhuaweicloud.com"
url = "https://{}/v1.0/{}/graphs/{}".format(base, my_project_id, my_graph_name)
another_url = "https://ges.cn-north-1.myhuaweicloud.com/v1.0/bb4478f419c34cd7889b0ab8639e81e6/graphs/ges_abfe"
fields = {"command":"graph=EywaGraph.open(\"ges_abfe\");g=graph.traversal();g.V().limit(10)"}
r = http.request('GET', another_url, headers=headers)#, fields=fields)
print(r.status)
print(r.data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment