Closed kirbylynx closed 6 years ago
The message is too brief, I can't idenfity where the problem is. Maybe you can check if everything(environment, apikey/secret, path, local file) is ok and give more tries.
You are sure this SDK currently works fine, right? Maybe it's my local problem.
Yes, you can run the testcases (I just checked), which have covered all the functions in the SDK and have made sure they work fine.
https://cloud.tencent.com/document/product/436/8432 Here's the error code table, but -48 is undocumented, unfortunately.
OK, thanks.
Is this right?
with open(local_file_name, "rb") as f:
file_object = f.read()
r = bucket.upload_file(file_object, "test.jpg",
"testdir", mime='image/jpeg')
f.close()
I'm pretty sure there is something wrong with upload_file. the parameter of "cos_path" in function of "sign_more" is empty. This may be the cause of my problem.
Are you sure you're using my latest code? Because if you do this:
r = bucket.upload_file(file_object, "test.jpg", "testdir", mime='image/jpeg')
You will get a fatal error because only 2 positional arguments are allowed: https://github.com/su27/qcloud_cos_py3/blob/master/qcloud_cos_py3/cos.py#L167
And the cos_path
must be empty.
Get response {'code': -48, 'message': 'ERROR_UNKOWN', 'request_id': '*****'} when using upload_file. Any idea?