[英]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.