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

升级v7.11.x后上传报错 #439

Closed
hoveychen opened this issue Aug 24, 2023 · 4 comments
Closed

升级v7.11.x后上传报错 #439

hoveychen opened this issue Aug 24, 2023 · 4 comments
Labels
help-wanted Denotes an issue that needs help from a contributor.

Comments

@hoveychen
Copy link

回退v7.10.0后问题修复。

调用代码

    qiniu_auth = qiniu.Auth(access_key, secret_key)
    key = f'{date}/{time}-{ran:02d}.{file_ext}'
    token = qiniu_auth.upload_token(qiniu_bucket, key, 3600)
    qiniu.put_data(token, key, bytes)

    return f'{qiniu_domain}/{key}'

错误提示

Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/miniconda3/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/miniconda3/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/miniconda3/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/root/xxxxxxxxxxxx.py", line 93, in fast_swap_face
    output_url = utils.upload_image(img)
  File "/root/xxxxxxxxxxxx.py", line 127, in upload_image
    return upload_file(byte_encode, 'png')
  File "/root/xxxxxxxxxxxx.py", line 63, in upload_file
    qiniu.put_data(token, key, bytes)
  File "/root/miniconda3/lib/python3.10/site-packages/qiniu/services/storage/uploader.py", line 45, in put_data
    return _form_put(up_token, key, final_data, params, mime_type,
  File "/root/miniconda3/lib/python3.10/site-packages/qiniu/services/storage/uploader.py", line 108, in _form_put
    url = config.get_default('default_zone').get_up_host_by_token(up_token, hostscache_dir)
  File "/root/miniconda3/lib/python3.10/site-packages/qiniu/region.py", line 45, in get_up_host_by_token
    up_hosts = self.get_up_host(ak, bucket, home_dir)
  File "/root/miniconda3/lib/python3.10/site-packages/qiniu/region.py", line 113, in get_up_host
    bucket_hosts = self.get_bucket_hosts(ak, bucket, home_dir)
  File "/root/miniconda3/lib/python3.10/site-packages/qiniu/region.py", line 144, in get_bucket_hosts
    hosts = compat.json.loads(self.bucket_hosts(ak, bucket)).get('hosts', [])
AttributeError: 'NoneType' object has no attribute 'get'
@lihsai0
Copy link
Collaborator

lihsai0 commented Aug 24, 2023

@hoveychen 未能复现。您那边可以稳定复现嘛?

初步判断是查询上传域名出问题了。如果您可以稳定复现,麻烦您 debug 一下 bucket_hosts(ak, bucket) 看看有没有更多关于请求错误信息。

r = qiniu.region.Region()
d = r.bucket_hosts(access_key, qiniu_bucket)
print(d)

最好可以 debug 看下 bucket_hosts 内部的 _resp 的内容。

@bachue bachue added the help-wanted Denotes an issue that needs help from a contributor. label Aug 24, 2023
@OlnyBigRoc
Copy link

OlnyBigRoc commented Sep 21, 2023

bucket_hosts

HTTPSConnectionPool(host='api.qiniu.com', port=443): Max retries exceeded with url: /v4/query?ak=&bucket= (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

@lihsai0
Copy link
Collaborator

lihsai0 commented Sep 25, 2023

@OlnyBigRoc 请检查 ak 与 bucket 设置正确。如果检查无误,麻烦附上复现代码~

@OlnyBigRoc
Copy link

OlnyBigRoc commented Oct 13, 2023

@OlnyBigRoc 请检查 ak 与 bucket 设置正确。如果检查无误,麻烦附上复现代码~

@lihsai0 对不起哇,我的问题是,挂了代理,没有把qbox.me加入绕过规则导致的,打扰了

@bachue bachue closed this as completed Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted Denotes an issue that needs help from a contributor.
Projects
None yet
Development

No branches or pull requests

4 participants