Пытается использовать запросы для получения токена с сервера приложений. Работает в curl, работает от DHC chrome extension, но не может получить код для работы. Скорее всего, что-то немое я пропустил или сделал.Получение маркера безопасности с запросами
https://knowledgecenter.appspace.com/5-4/other-resources/developer-guides/appspace-graph-api-examples https://knowledgecenter.appspace.com/5-4/other-resources/developer-guides/appspace-graph-api
Я попытался
url = 'http://10.2.3.205/api/v1/token/request'
headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
data = {"Authentication" :
{"Username": "[email protected]",
"Password": "password"
}
}
r = requests.get(url, auth=(data), headers=headers)
print r.status_code
print r.headers['content-type']
который дает объект Dict не отозваны ошибки
также получить ту же ошибку с
auth = {"Username": "[email protected]",
"Password": "password"
}
также попытался
auth = {"Authentication" :
{"Username": "[email protected]",
"Password": "password"
}
}
r = requests.post(url, params=auth, headers=headers)
который дает
200
application/json; charset=utf-8
{"Errors":[{"Code":"500","Message":"Token request object is null"}],"Status":2}
и более непосредственно с
r = requests.get(url, auth=("[email protected]", "password"), headers=headers)
, который дает
405
text/html; charset=UTF-8
и несколько других способов, а также, которые дают 405 ошибок, а также.
локон получает жетон
$ curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" -d '{"Authentication" :
{"Username": "[email protected]",
"Password": "password"
}
}' 'http://10.2.3.205/api/v1/token/request'
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 67
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 03 Mar 2015 14:21:17 GMT
{"Status":1,"SecurityToken":"valid token string"}
Спасибо