Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip安装7.2.6 auth.QiniuMacAuth.token_of_request方法有误 #355

Open
hoohre opened this issue Feb 15, 2020 · 5 comments
Open

pip安装7.2.6 auth.QiniuMacAuth.token_of_request方法有误 #355

hoohre opened this issue Feb 15, 2020 · 5 comments
Labels
waiting-for-info Issue is not actionable because of missing required information, which needs to be provided.

Comments

@hoohre
Copy link

hoohre commented Feb 15, 2020

源码auth.py 266行 if content_type and content_type != "application/octet-stream" and body: if isinstance(body,bytes): data += body.decode(encoding='UTF-8') else: data += body
源码正确,安装包错误

@forrest-mao forrest-mao added the to-be-confirmed Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 22, 2020
@forrest-mao
Copy link
Contributor

forrest-mao commented Jul 22, 2020

内部issue TS-999

@songfei9315
Copy link
Contributor

我测试都是正常,python3、2都是正常安装,你那边报什么错?什么版本?怎么复现?

@forrest-mao forrest-mao added waiting-for-info Issue is not actionable because of missing required information, which needs to be provided. and removed to-be-confirmed Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 27, 2020
@hoohre
Copy link
Author

hoohre commented Aug 28, 2020

异步抓取图片

def test_qn_fetch(self):
       q = QiniuMacAuth(self.access_key, self.secret_key)
       api = 'http://api-as0.qiniu.com/sisyphus/fetch'

       avatar = 'https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1782959667,617309577&fm=26&gp=0.jpg'
       key, _t = self.get_key(), 1
       userid, flag = '08400348188', 1
       # callbackurl = QN_callback.format(QN_callback_ssa_gl if _t == 1 else QN_callback_ssa_fb, 'userid={0}&flag={1}'.format(userid, flag))
       # callbackbody = "key=$(key)&{0}={1}".format('url', avatar)

       data = {
           "url": avatar,
           "bucket": self.bucket,
           "key": key,
           # "callbackurl": callbackurl,
           # "callbackbody": callbackbody,
       }

       ret, info = http._post_with_qiniu_mac(api, data, q)
       print('ret: ', ret)
       print('info: ', info)

测试异常

(py3t) houh@houhdeMacBook-Pro py36test % python -m unittest test/qiniusdk/token_test.py
.ret: None
info: _ResponseInfo__response:None, exception:can only concatenate str (not "bytes") to str, status_code:-1, text_body:None, req_id:None, x_log:None, error:can only concatenate str (not "bytes") to str
.

Ran 2 tests in 0.002s

OK
python qiniu版本
(py3t) houh@houhdeMacBook-Pro py36test % python -V
Python 3.7.3
(py3t) houh@houhdeMacBook-Pro py36test % pip list | grep qiniu
qiniu 7.2.6

应该是没有判断body类型
image

@htaoji1988
Copy link

为啥我生成的管理凭证,用postman请求时报"bad token"

@hoohre
Copy link
Author

hoohre commented Apr 21, 2021

为啥我生成的管理凭证,用postman请求时报"bad token"

贴上部分代码,注意header部分数据处理和'\n' 参考 https://developer.qiniu.com/kodo/1201/access-token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-info Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants