本文整理汇总了Python中botocore.awsrequest.create_request_object方法的典型用法代码示例。如果您正苦于以下问题:Python awsrequest.create_request_object方法的具体用法?Python awsrequest.create_request_object怎么用?Python awsrequest.create_request_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botocore.awsrequest
的用法示例。
在下文中一共展示了awsrequest.create_request_object方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_presigned_url
# 需要导入模块: from botocore import awsrequest [as 别名]
# 或者: from botocore.awsrequest import create_request_object [as 别名]
def generate_presigned_url(self, request_dict, operation_name,
expires_in=3600, region_name=None):
"""Generates a presigned url
:type request_dict: dict
:param request_dict: The prepared request dictionary returned by
``botocore.awsrequest.prepare_request_dict()``
:type operation_name: str
:param operation_name: The operation being signed.
:type expires_in: int
:param expires_in: The number of seconds the presigned url is valid
for. By default it expires in an hour (3600 seconds)
:type region_name: string
:param region_name: The region name to sign the presigned url.
:returns: The presigned url
"""
request = create_request_object(request_dict)
self.sign(operation_name, request, region_name,
'presign-url', expires_in)
request.prepare()
return request.url
示例2: create_request
# 需要导入模块: from botocore import awsrequest [as 别名]
# 或者: from botocore.awsrequest import create_request_object [as 别名]
def create_request(self, params, operation_model=None):
request = create_request_object(params)
if operation_model:
event_name = 'request-created.{endpoint_prefix}.{op_name}'.format(
endpoint_prefix=self._endpoint_prefix,
op_name=operation_model.name)
self._event_emitter.emit(event_name, request=request,
operation_name=operation_model.name)
prepared_request = self.prepare_request(request)
return prepared_request
示例3: generate_presigned_url
# 需要导入模块: from botocore import awsrequest [as 别名]
# 或者: from botocore.awsrequest import create_request_object [as 别名]
def generate_presigned_url(self, request_dict, operation_name,
expires_in=3600, region_name=None,
signing_name=None):
"""Generates a presigned url
:type request_dict: dict
:param request_dict: The prepared request dictionary returned by
``botocore.awsrequest.prepare_request_dict()``
:type operation_name: str
:param operation_name: The operation being signed.
:type expires_in: int
:param expires_in: The number of seconds the presigned url is valid
for. By default it expires in an hour (3600 seconds)
:type region_name: string
:param region_name: The region name to sign the presigned url.
:type signing_name: str
:param signing_name: The name to use for the service when signing.
:returns: The presigned url
"""
request = create_request_object(request_dict)
self.sign(operation_name, request, region_name,
'presign-url', expires_in, signing_name)
request.prepare()
return request.url
示例4: create_request
# 需要导入模块: from botocore import awsrequest [as 别名]
# 或者: from botocore.awsrequest import create_request_object [as 别名]
def create_request(self, params, operation_model=None):
request = create_request_object(params)
if operation_model:
request.stream_output = any([
operation_model.has_streaming_output,
operation_model.has_event_stream_output
])
service_id = operation_model.service_model.service_id.hyphenize()
event_name = 'request-created.{service_id}.{op_name}'.format(
service_id=service_id,
op_name=operation_model.name)
self._event_emitter.emit(event_name, request=request,
operation_name=operation_model.name)
prepared_request = self.prepare_request(request)
return prepared_request
示例5: _create_prepared_request
# 需要导入模块: from botocore import awsrequest [as 别名]
# 或者: from botocore.awsrequest import create_request_object [as 别名]
def _create_prepared_request(
self,
params: Dict,
operation_model: Optional[Any],
) -> AWSPreparedRequest:
request = create_request_object(params)
self._sign_request(request)
prepared_request = self.client._endpoint.prepare_request(request)
if self._extra_headers is not None:
prepared_request.headers.update(self._extra_headers)
return prepared_request