本文整理匯總了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