本文整理汇总了Python中msrest.pipeline.ClientRawResponse类的典型用法代码示例。如果您正苦于以下问题:Python ClientRawResponse类的具体用法?Python ClientRawResponse怎么用?Python ClientRawResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClientRawResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get307
def get307(
self, custom_headers={}, raw=False, **operation_config):
"""
Redirect get with 307, resulting in a 200 success
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: None or (None, requests.response) or concurrent.futures.Future
"""
# Construct URL
url = '/http/redirect/307'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200, 307]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'Location': 'str',
})
return client_raw_response
开发者ID:kshapkin,项目名称:autorest,代码行数:35,代码来源:http_redirects.py
示例2: get_long_running_output
def get_long_running_output(response):
if response.status_code not in [200, 202]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('Product', response)
header_dict = {
'Location': 'str',
'Retry-After': 'int',
}
if response.status_code == 202:
deserialized = self._deserialize('Product', response)
header_dict = {
'Location': 'str',
'Retry-After': 'int',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
return deserialized
开发者ID:kshapkin,项目名称:autorest,代码行数:29,代码来源:lro_retrys_operations.py
示例3: get_long_running_output
def get_long_running_output(response):
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'location': 'str',
})
return client_raw_response
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:7,代码来源:runbook_operations.py
示例4: response_protected_key
def response_protected_key(self, custom_headers={}, raw=False, **operation_config):
"""
Get a response with header value "Content-Type": "text/html"
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: None or (None, requests.response) or concurrent.futures.Future
"""
# Construct URL
url = "/header/response/protectedkey"
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters["Content-Type"] = "application/json; charset=utf-8"
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({"Content-Type": "str"})
return client_raw_response
开发者ID:kshapkin,项目名称:autorest,代码行数:32,代码来源:header.py
示例5: get_entity_tag
def get_entity_tag(
self, resource_group_name, service_name, api_id, custom_headers=None, raw=False, **operation_config):
"""Gets the entity state (Etag) version of the API policy specified by its
identifier.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param service_name: The name of the API Management service.
:type service_name: str
:param api_id: API revision identifier. Must be unique in the current
API Management service instance. Non-current revision has ;rev=n as a
suffix where n is the revision number.
:type api_id: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_entity_tag.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'),
'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'),
'policyId': self._serialize.url("self.policy_id", self.policy_id, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.head(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'ETag': 'str',
})
return client_raw_response
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:60,代码来源:api_policy_operations.py
示例6: head300
def head300(
self, custom_headers={}, raw=False, **operation_config):
"""
Return 300 status code and redirect to /http/success/200
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: None or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/http/redirect/300'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.head(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200, 300]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'Location': 'str',
})
return client_raw_response
开发者ID:CamSoper,项目名称:autorest,代码行数:35,代码来源:http_redirects.py
示例7: response_existing_key
def response_existing_key(
self, custom_headers={}, raw=False, **operation_config):
"""
Get a response with header value "User-Agent": "overwrite"
:param dict custom_headers: headers that will be added to the request
:param boolean raw: returns the direct response alongside the
deserialized response
:rtype: None or msrest.pipeline.ClientRawResponse
"""
# Construct URL
url = '/header/response/existingkey'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'User-Agent': 'str',
})
return client_raw_response
开发者ID:CamSoper,项目名称:autorest,代码行数:35,代码来源:header.py
示例8: get_entity_tag
def get_entity_tag(
self, resource_group_name, service_name, identity_provider_name, custom_headers=None, raw=False, **operation_config):
"""Gets the entity state (Etag) version of the identityProvider specified
by its identifier.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param service_name: The name of the API Management service.
:type service_name: str
:param identity_provider_name: Identity Provider Type identifier.
Possible values include: 'facebook', 'google', 'microsoft', 'twitter',
'aad', 'aadB2C'
:type identity_provider_name: str or
~azure.mgmt.apimanagement.models.IdentityProviderType
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_entity_tag.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'),
'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.head(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'ETag': 'str',
})
return client_raw_response
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:60,代码来源:identity_provider_operations.py
示例9: _update_initial
def _update_initial(
self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters=None, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'),
'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'),
'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
if parameters is not None:
body_content = self._serialize.body(parameters, 'ServerEndpointUpdateParameters')
else:
body_content = None
# Construct and send request
request = self._client.patch(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 202]:
raise models.StorageSyncErrorException(self._deserialize, response)
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('ServerEndpoint', response)
header_dict = {
'x-ms-request-id': 'str',
'x-ms-correlation-request-id': 'str',
'Azure-AsyncOperation': 'str',
'Location': 'str',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
return deserialized
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:59,代码来源:server_endpoints_operations.py
示例10: _create_or_update_initial
def _create_or_update_initial(
self, resource_group_name, service_name, api_id, parameters, if_match=None, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create_or_update.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'),
'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if if_match is not None:
header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'ApiCreateOrUpdateParameter')
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 201, 202]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('ApiContract', response)
header_dict = {
'ETag': 'str',
}
if response.status_code == 201:
deserialized = self._deserialize('ApiContract', response)
header_dict = {
'ETag': 'str',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
return deserialized
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:59,代码来源:api_operations.py
示例11: delete
def delete(
self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config):
"""Delete a given SyncGroup.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param storage_sync_service_name: Name of Storage Sync Service
resource.
:type storage_sync_service_name: str
:param sync_group_name: Name of Sync Group resource.
:type sync_group_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`StorageSyncErrorException<azure.mgmt.storagesync.models.StorageSyncErrorException>`
"""
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'),
'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 204]:
raise models.StorageSyncErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'x-ms-request-id': 'str',
'x-ms-correlation-request-id': 'str',
})
return client_raw_response
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:59,代码来源:sync_groups_operations.py
示例12: query
def query(
self, query_specification, custom_headers=None, raw=False, **operation_config):
"""Query the device enrollment records.
:param query_specification: The query specification.
:type query_specification: ~serviceswagger.models.QuerySpecification
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: list or ClientRawResponse if raw=true
:rtype: list[~serviceswagger.models.IndividualEnrollment] or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProvisioningServiceErrorDetailsException<serviceswagger.models.ProvisioningServiceErrorDetailsException>`
"""
# Construct URL
url = '/enrollments/query'
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
body_content = self._serialize.body(query_specification, 'QuerySpecification')
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200, 400, 401, 404, 415, 429, 500]:
raise models.ProvisioningServiceErrorDetailsException(self._deserialize, response)
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('[IndividualEnrollment]', response)
header_dict = {
'x-ms-continuation': 'str',
'x-ms-max-item-count': 'int',
'x-ms-item-type': 'str',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
return deserialized
开发者ID:dqj,项目名称:azure-iot-sdk-python,代码行数:58,代码来源:device_enrollment_operations.py
示例13: get_long_running_output
def get_long_running_output(response):
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'x-ms-request-id': 'str',
'x-ms-correlation-request-id': 'str',
'Location': 'str',
})
return client_raw_response
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:9,代码来源:server_endpoints_operations.py
示例14: _create_initial
def _create_initial(
self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[-\w\._]+$'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'BatchAccountCreateParameters')
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
if response.status_code not in [200, 202]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('BatchAccount', response)
header_dict = {
'Location': 'str',
'Retry-After': 'int',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
try:
client_raw_response.add_headers(header_dict)
except DeserializationError:
pass # Deserialization of Headers here can fail
return client_raw_response
return deserialized
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:57,代码来源:batch_account_operations.py
示例15: custom_named_request_id_param_grouping
def custom_named_request_id_param_grouping(
self, header_custom_named_request_id_param_grouping_parameters, custom_headers=None, raw=False, **operation_config):
"""Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in
the header of the request, via a parameter group.
:param header_custom_named_request_id_param_grouping_parameters:
Additional parameters for the operation
:type header_custom_named_request_id_param_grouping_parameters:
:class:`HeaderCustomNamedRequestIdParamGroupingParameters
<fixtures.acceptancetestsazurespecials.models.HeaderCustomNamedRequestIdParamGroupingParameters>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: None or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises:
:class:`ErrorException<fixtures.acceptancetestsazurespecials.models.ErrorException>`
"""
foo_client_request_id = None
if header_custom_named_request_id_param_grouping_parameters is not None:
foo_client_request_id = header_custom_named_request_id_param_grouping_parameters.foo_client_request_id
# Construct URL
url = '/azurespecials/customNamedRequestIdParamGrouping'
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['foo-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", foo_client_request_id, 'str')
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'foo-request-id': 'str',
})
return client_raw_response
开发者ID:lmazuel,项目名称:autorest,代码行数:57,代码来源:header_operations.py
示例16: _create_or_update_initial
def _create_or_update_initial(
self, resource_group_name, rollout_name, rollout_request=None, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create_or_update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'rolloutName': self._serialize.url("rollout_name", rollout_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
if rollout_request is not None:
body_content = self._serialize.body(rollout_request, 'RolloutRequest')
else:
body_content = None
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
header_dict = {}
if response.status_code == 201:
deserialized = self._deserialize('RolloutRequest', response)
header_dict = {
'Azure-AsyncOperation': 'str',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
return deserialized
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:56,代码来源:rollouts_operations.py
示例17: get_details
def get_details(
self, operation_id, custom_headers=None, raw=False, **operation_config):
"""Gets details of a specific long running operation.
:param operation_id: Operation id.
:type operation_id: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: Operation or ClientRawResponse if raw=true
:rtype: ~azure.cognitiveservices.knowledge.qnamaker.models.Operation
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_details.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
'operationId': self._serialize.url("operation_id", operation_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
header_dict = {}
if response.status_code == 200:
deserialized = self._deserialize('Operation', response)
header_dict = {
'RetryAfter': 'int',
}
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
client_raw_response.add_headers(header_dict)
return client_raw_response
return deserialized
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:56,代码来源:operations.py
示例18: get_long_running_output
def get_long_running_output(response):
if response.status_code not in [202]:
exp = CloudError(response)
exp.request_id = response.headers.get("x-ms-request-id")
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({"Location": "str", "Retry-After": "int"})
return client_raw_response
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:lro_retrys_operations.py
示例19: get_long_running_output
def get_long_running_output(response):
if response.status_code not in [202, 204]:
raise models.ErrorResponseWrapperException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response.add_headers({
'Location': 'str',
})
return client_raw_response
开发者ID:AutorestCI,项目名称:azure-sdk-for-python,代码行数:11,代码来源:operationalization_clusters_operations.py
示例20: get_long_running_output
|
请发表评论