本文整理汇总了Python中boto.connection.AWSAuthConnection方法的典型用法代码示例。如果您正苦于以下问题:Python connection.AWSAuthConnection方法的具体用法?Python connection.AWSAuthConnection怎么用?Python connection.AWSAuthConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.connection
的用法示例。
在下文中一共展示了connection.AWSAuthConnection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _instrument
# 需要导入模块: from boto import connection [as 别名]
# 或者: from boto.connection import AWSAuthConnection [as 别名]
def _instrument(self, **kwargs):
# AWSQueryConnection and AWSAuthConnection are two different classes
# called by different services for connection.
# For exemple EC2 uses AWSQueryConnection and S3 uses
# AWSAuthConnection
# FIXME should the tracer provider be accessed via Configuration
# instead?
# pylint: disable=attribute-defined-outside-init
self._tracer = get_tracer(
__name__, __version__, kwargs.get("tracer_provider")
)
wrap_function_wrapper(
"boto.connection",
"AWSQueryConnection.make_request",
self._patched_query_request,
)
wrap_function_wrapper(
"boto.connection",
"AWSAuthConnection.make_request",
self._patched_auth_request,
)
示例2: _uninstrument
# 需要导入模块: from boto import connection [as 别名]
# 或者: from boto.connection import AWSAuthConnection [as 别名]
def _uninstrument(self, **kwargs):
unwrap(AWSQueryConnection, "make_request")
unwrap(AWSAuthConnection, "make_request")
示例3: _attempt_resumable_download
# 需要导入模块: from boto import connection [as 别名]
# 或者: from boto.connection import AWSAuthConnection [as 别名]
def _attempt_resumable_download(self, key, fp, headers, cb, num_cb,
torrent, version_id, hash_algs):
"""
Attempts a resumable download.
Raises ResumableDownloadException if any problems occur.
"""
cur_file_size = get_cur_file_size(fp, position_to_eof=True)
if (cur_file_size and
self.etag_value_for_current_download and
self.etag_value_for_current_download == key.etag.strip('"\'')):
# Try to resume existing transfer.
if cur_file_size > key.size:
raise ResumableDownloadException(
'%s is larger (%d) than %s (%d).\nDeleting tracker file, so '
'if you re-try this download it will start from scratch' %
(fp.name, cur_file_size, str(storage_uri_for_key(key)),
key.size), ResumableTransferDisposition.ABORT)
elif cur_file_size == key.size:
if key.bucket.connection.debug >= 1:
print('Download complete.')
return
if key.bucket.connection.debug >= 1:
print('Resuming download.')
headers = headers.copy()
headers['Range'] = 'bytes=%d-%d' % (cur_file_size, key.size - 1)
cb = ByteTranslatingCallbackHandler(cb, cur_file_size).call
self.download_start_point = cur_file_size
else:
if key.bucket.connection.debug >= 1:
print('Starting new resumable download.')
self._save_tracker_info(key)
self.download_start_point = 0
# Truncate the file, in case a new resumable download is being
# started atop an existing file.
fp.truncate(0)
# Disable AWSAuthConnection-level retry behavior, since that would
# cause downloads to restart from scratch.
if isinstance(key, GSKey):
key.get_file(fp, headers, cb, num_cb, torrent, version_id,
override_num_retries=0, hash_algs=hash_algs)
else:
key.get_file(fp, headers, cb, num_cb, torrent, version_id,
override_num_retries=0)
fp.flush()
示例4: _attempt_resumable_download
# 需要导入模块: from boto import connection [as 别名]
# 或者: from boto.connection import AWSAuthConnection [as 别名]
def _attempt_resumable_download(self, key, fp, headers, cb, num_cb,
torrent, version_id):
"""
Attempts a resumable download.
Raises ResumableDownloadException if any problems occur.
"""
cur_file_size = get_cur_file_size(fp, position_to_eof=True)
if (cur_file_size and
self.etag_value_for_current_download and
self.etag_value_for_current_download == key.etag.strip('"\'')):
# Try to resume existing transfer.
if cur_file_size > key.size:
raise ResumableDownloadException(
'%s is larger (%d) than %s (%d).\nDeleting tracker file, so '
'if you re-try this download it will start from scratch' %
(fp.name, cur_file_size, str(storage_uri_for_key(key)),
key.size), ResumableTransferDisposition.ABORT)
elif cur_file_size == key.size:
if key.bucket.connection.debug >= 1:
print 'Download complete.'
return
if key.bucket.connection.debug >= 1:
print 'Resuming download.'
headers = headers.copy()
headers['Range'] = 'bytes=%d-%d' % (cur_file_size, key.size - 1)
cb = ByteTranslatingCallbackHandler(cb, cur_file_size).call
self.download_start_point = cur_file_size
else:
if key.bucket.connection.debug >= 1:
print 'Starting new resumable download.'
self._save_tracker_info(key)
self.download_start_point = 0
# Truncate the file, in case a new resumable download is being
# started atop an existing file.
fp.truncate(0)
# Disable AWSAuthConnection-level retry behavior, since that would
# cause downloads to restart from scratch.
key.get_file(fp, headers, cb, num_cb, torrent, version_id,
override_num_retries=0)
fp.flush()