“'HmacAuthV1Handler' 对象没有属性 'presign'”是什么意思?
What does ''HmacAuthV1Handler' object has no attribute 'presign'' mean?
我想使用 boto2 (2.49) 创建一个使用 Sign v4 的预签名 url。
这是我的函数:
c = S3Connection(access_key, secret_key)
return c.generate_url_sigv4(
expires_in=long(expiry),
method='PUT',
bucket=bucket,
key=path
)
当我 运行 它时,我得到了这个错误:
2019-06-18 12:57:51,002 boto [DEBUG]:Using access key provided by client.
2019-06-18 12:57:51,002 boto [DEBUG]:Using secret key provided by client.
Traceback (most recent call last):
File "scripts/gen_url.py", line 42, in <module>
main(key, secret)
File "scripts/gen_url.py", line 33, in main
print sign(key, secret, s3_bucket, object_name, mime_type, expires, region)
File "scripts/gen_url.py", line 21, in sign
key=path
File "/Users/antkong/Documents/Personal/wd/WhosebugCode/python/boto2-sign-v4/python-ve/lib/python2.7/site-packages/boto/s3/connection.py", line 380, in generate_url_sigv4
return self._auth_handler.presign(http_request, expires_in,
AttributeError: 'HmacAuthV1Handler' object has no attribute 'presign'
我想在 google 应用程序引擎中 运行 这段代码,所以我无法放入 boto 配置。那么我如何与我需要的 s3 连接通信 S3SignV4
最后我用环境变量解决了这个问题:
os.environ['S3_USE_SIGV4'] = 'True'
只需在创建`S3Connection 之前添加以上行即可。
我想使用 boto2 (2.49) 创建一个使用 Sign v4 的预签名 url。
这是我的函数:
c = S3Connection(access_key, secret_key)
return c.generate_url_sigv4(
expires_in=long(expiry),
method='PUT',
bucket=bucket,
key=path
)
当我 运行 它时,我得到了这个错误:
2019-06-18 12:57:51,002 boto [DEBUG]:Using access key provided by client.
2019-06-18 12:57:51,002 boto [DEBUG]:Using secret key provided by client.
Traceback (most recent call last):
File "scripts/gen_url.py", line 42, in <module>
main(key, secret)
File "scripts/gen_url.py", line 33, in main
print sign(key, secret, s3_bucket, object_name, mime_type, expires, region)
File "scripts/gen_url.py", line 21, in sign
key=path
File "/Users/antkong/Documents/Personal/wd/WhosebugCode/python/boto2-sign-v4/python-ve/lib/python2.7/site-packages/boto/s3/connection.py", line 380, in generate_url_sigv4
return self._auth_handler.presign(http_request, expires_in,
AttributeError: 'HmacAuthV1Handler' object has no attribute 'presign'
我想在 google 应用程序引擎中 运行 这段代码,所以我无法放入 boto 配置。那么我如何与我需要的 s3 连接通信 S3SignV4
最后我用环境变量解决了这个问题:
os.environ['S3_USE_SIGV4'] = 'True'
只需在创建`S3Connection 之前添加以上行即可。