[英]Bluemix IBM Graph service - Create vertices
我正在尝试使用顶点API创建一个顶点。
请查看以下代码段。
def create_vertex(self,creds,id):
creds = json.load(open(creds))
print(creds)
url = creds['credentials']['apiURL'] + '/vertices'
start = time.time()
res = requests.post(
url,
auth=(
creds['credentials']['username'],
creds['credentials']['password']
),
data=json.dumps([{"id":"256"}]),
headers={"Content-Type": "application/json"}
)
res.raise_for_status()
print 'query took %s seconds' % (time.time() - start)
return res.json()
API网址上的curl正常运行,我收到以下响应
{
"requestId":"49646d73-0073-450a-9976-57049821fa42",
"status":{
"message":"",
"code":200,
"attributes":{}
},
"result":{
"data":["StandardTitanGraph"],
"meta":{}
}
}
我想这个回应是正确的。
但是API URL给我以下错误。
引发HTTPError(http_error_msg,response = self)request.exceptions.HTTPError:502服务器错误:错误的网关
如上文所述,该问题已在该服务的最新版本中得到解决。 请重试并更新此问题。
为了获取最新更新,您将需要创建一个新服务https://console.ng.bluemix.net/catalog/services/graph-data-store/并对其运行程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.