本文整理汇总了Python中msrest.service_client.ServiceClient.delete方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceClient.delete方法的具体用法?Python ServiceClient.delete怎么用?Python ServiceClient.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msrest.service_client.ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SwaggerPetstore
# 需要导入模块: from msrest.service_client import ServiceClient [as 别名]
# 或者: from msrest.service_client.ServiceClient import delete [as 别名]
#.........这里部分代码省略.........
url = '/pet/{petId}'
path_format_arguments = {
'petId': self._serialize.url("pet_id", pet_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/x-www-form-urlencoded'
if custom_headers:
header_parameters.update(custom_headers)
# Construct form data
form_data_content = {
'name': name,
'status': status,
}
# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send_formdata(
request, header_parameters, form_data_content, **operation_config)
if response.status_code not in [405]:
raise HttpOperationError(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def delete_pet(
self, pet_id, api_key=None, custom_headers=None, raw=False, **operation_config):
"""Deletes a pet.
:param pet_id: Pet id to delete
:type pet_id: long
:param api_key:
:type api_key: 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>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/pet/{petId}'
path_format_arguments = {
'petId': self._serialize.url("pet_id", pet_id, 'long')
}
url = self._client.format_url(url, **path_format_arguments)
# 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)
if api_key is not None: