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

是否这个sdk不支持python3.7.4 #7

Open
ttcool opened this issue Dec 4, 2020 · 3 comments
Open

是否这个sdk不支持python3.7.4 #7

ttcool opened this issue Dec 4, 2020 · 3 comments

Comments

@ttcool
Copy link

ttcool commented Dec 4, 2020

huaweicloud-sdk-python-obs 版本 Version 3.20.11 python 版本 3.7.4 上传文件返回状态码 403 ,python版本3.7.0 ,3.52 正常返回状态200,是否这个sdk不支持python3.7.4

@ttcool
Copy link
Author

ttcool commented Dec 7, 2020

from obs import ObsClient
from obs import LogConf

obsClient = ObsClient(
access_key_id=obs_access_key_id,
secret_access_key=obs_secret_access_key,
server=obs_server
)
obsClient.initLog(LogConf('./log.conf'), 'obs_logger');

def upload_obs_file(bucket_name,filename,uploadFile):
taskNum = 5
partSize = 10 * 1024 * 1024
enableCheckpoint = True
try:
resp = obsClient.uploadFile(bucket_name, filename, uploadFile, partSize, taskNum, enableCheckpoint)
print(resp)
if resp.status < 300:
print('requestId:', resp.requestId)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc())

upload_obs_file('front','test20201202.txt','/data/test20201202.txt')

Traceback (most recent call last):
File "obs_test.py", line 22, in upload_obs_file
resp = obsClient.uploadFile(bucket_name, filename, uploadFile, partSize, taskNum, enableCheckpoint)
File "/usr/local/python/lib/python3.7/site-packages/esdk_obs_python-3.20.11-py3.7.egg/obs/client.py", line 166, in wrapper
raise e
File "/usr/local/python/lib/python3.7/site-packages/esdk_obs_python-3.20.11-py3.7.egg/obs/client.py", line 162, in wrapper
ret = func(*args, **kwargs)
File "/usr/local/python/lib/python3.7/site-packages/esdk_obs_python-3.20.11-py3.7.egg/obs/client.py", line 2207, in uploadFile
checkSum, metadata, progressCallback, self, headers, extensionHeaders=extensionHeaders)
File "/usr/local/python/lib/python3.7/site-packages/esdk_obs_python-3.20.11-py3.7.egg/obs/transfer.py", line 44, in _resumer_upload
headers, extensionHeaders=extensionHeaders)
File "/usr/local/python/lib/python3.7/site-packages/esdk_obs_python-3.20.11-py3.7.egg/obs/transfer.py", line 140, in init
raise Exception('head bucket {0} failed. Please check. Status:{1}.'.format(self.bucketName, resp.status))
Exception: head bucket front failed. Please check. Status:403.

@ttcool
Copy link
Author

ttcool commented Dec 7, 2020

error message

@x00403408
Copy link
Collaborator

建议您提供一些更详细的错误信息,可以测试get接口以获取对应403情况下的errorCode以及errorMessage信息;另外可以提供一下SDK的日志以协助更好地定位返回403错误的具体原因;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants