如何在python 3(icq auth)中生成hmac符号?

时间:2017-02-12 23:34:54

标签: python-3.x icq

我的代码: http://pastebin.com/fuFxaxTT

并有链接:

http://api.icq.net/aim/startSession?f=json&language=ru&events=mchat%2CuserAddedToBuddyList%2Chist%2CimState%2Cbuddylist&includePresenceFields=aimId%2Cfriendly%2Cstate%2Cssl&sessionTimeout=2592000&ts=1486941017&k=ic17mFHiwr52TKrx&a=%252FwQAAAAAAAGM2*****OTVCDd%252BSNbxZMzUDE0FKQ3Dc2MCVL8DpHgHX8z8%252BWEK3UI6LmhnP362bl%252FluMpxZB033a6qvxSmIkiCsY%253D&view=online&invisible=false&mobile=0&sig_sha256=gI93nv8lo0n9t3*****6uSH43fKnQzPL8Yo=

但有错误:

{"response":{"statusCode":401, "statusText":"Authentication Required.  statusDetailCode 1014", "statusDetailCode":1014, "data":{"ts":1486941017}}}

我在nodejs中找到了示例 - https://gist.github.com/foozzi/1382fce29b87bf2ea5544ca73a54a4d4#file-gistfile1-txt-L205 ,但我的代码中出错?

1 个答案:

答案 0 :(得分:0)

也许为时已晚,但我刚刚在C#上成功实现了会话创建,我可以分享一些经验。 根据{{​​3}},他们形成的URL签名略有不同,如下所示 -

"POST&" + UrlEncode(url) + "&" + UrlEncode("param1=UrlEncode(value1)&param2=UrlEncode(value2)&...")

所以我猜你在某些地方错过了网址编码。