curl https://api.box.com/2.0/folders/0 -H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN"
这样可以正常返回我想要的内容。
request = urllib2.Request("https://api.box.com/2.0/folders/0")
request.addheaders = [("Authorization: BoxAuth", "api_key="+apikey+"&auth_token="+auth_token)]
response = urllib2.urlopen(request)
这不会,并返回401错误。 (PYTHON)
答案 0 :(得分:2)
应该是:
request.add_header("Authorization", "BoxAuth api_key="+apikey+"&auth_token="+auth_token)