petstore_api.PetApi
All URIs are relative to http://petstore.swagger.io:80/v2
add_pet
add_pet(pet)
Add a new pet to the store
Add a new pet to the store
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.pet import Pet
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP message signature: http_signature_test
# The HTTP Signature Header mechanism that can be used by a client to
# authenticate the sender of a message and ensure that particular headers
# have not been modified in transit.
#
# You can specify the signing key-id, private key path, signing scheme,
# signing algorithm, list of signed headers and signature max validity.
# The 'key_id' parameter is an opaque string that the API server can use
# to lookup the client and validate the signature.
# The 'private_key_path' parameter should be the path to a file that
# contains a DER or base-64 encoded private key.
# The 'private_key_passphrase' parameter is optional. Set the passphrase
# if the private key is encrypted.
# The 'signed_headers' parameter is used to specify the list of
# HTTP headers included when generating the signature for the message.
# You can specify HTTP headers that you want to protect with a cryptographic
# signature. Note that proxies may add, modify or remove HTTP headers
# for legitimate reasons, so you should only add headers that you know
# will not be modified. For example, if you want to protect the HTTP request
# body, you can specify the Digest header. In that case, the client calculates
# the digest of the HTTP request body and includes the digest in the message
# signature.
# The 'signature_max_validity' parameter is optional. It is configured as a
# duration to express when the signature ceases to be valid. The client calculates
# the expiration date every time it generates the cryptographic signature
# of an HTTP request. The API server may have its own security policy
# that controls the maximum validity of the signature. The client max validity
# must be lower than the server max validity.
# The time on the client and server must be synchronized, otherwise the
# server may reject the client signature.
#
# The client must use a combination of private key, signing scheme,
# signing algorithm and hash algorithm that matches the security policy of
# the API server.
#
# See petstore_api.signing for a list of all supported parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2",
signing_info = petstore_api.signing.HttpSigningConfiguration(
key_id = 'my-key-id',
private_key_path = 'private_key.pem',
private_key_passphrase = 'YOUR_PASSPHRASE',
signing_scheme = petstore_api.signing.SCHEME_HS2019,
signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3,
hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256,
signed_headers = [
petstore_api.signing.HEADER_REQUEST_TARGET,
petstore_api.signing.HEADER_CREATED,
petstore_api.signing.HEADER_EXPIRES,
petstore_api.signing.HEADER_HOST,
petstore_api.signing.HEADER_DATE,
petstore_api.signing.HEADER_DIGEST,
'Content-Type',
'Content-Length',
'User-Agent'
],
signature_max_validity = datetime.timedelta(minutes=5)
)
)
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
body = Pet(
id=1,
category=Category(
id=1,
name="default-name",
),
name="doggie",
photo_urls=[
"photo_urls_example"
],
tags=[
Tag(
id=1,
name="name_example",
)
],
status="available",
)
try:
# Add a new pet to the store
api_response = api_instance.add_pet(
body=body,
)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->add_pet: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
body |
typing.Union[SchemaForRequestBodyApplicationJson, SchemaForRequestBodyApplicationXml] |
required |
|
content_type |
str |
optional, default is 'application/json' |
Selects the schema and serialization of the request body |
host_index |
typing.Optional[int] |
default is None |
Allows one to select a different host |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
body
SchemaForRequestBodyApplicationJson
Type |
Description |
Notes |
Pet |
|
|
SchemaForRequestBodyApplicationXml
Type |
Description |
Notes |
Pet |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
200 |
ApiResponseFor200 |
Ok |
405 |
ApiResponseFor405 |
Invalid input |
ApiResponseFor200
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
ApiResponseFor405
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
void (empty response body)
Authorization
http_signature_test, petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_pet
delete_pet(pet_id)
Deletes a pet
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
path_params = {
'petId': 1,
}
header_params = {
}
try:
# Deletes a pet
api_response = api_instance.delete_pet(
path_params=path_params,
header_params=header_params,
)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->delete_pet: %s\n" % e)
# example passing only optional values
path_params = {
'petId': 1,
}
header_params = {
'api_key': "api_key_example",
}
try:
# Deletes a pet
api_response = api_instance.delete_pet(
path_params=path_params,
header_params=header_params,
)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->delete_pet: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
header_params |
RequestHeaderParams |
|
|
path_params |
RequestPathParams |
|
|
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
Name |
Type |
Description |
Notes |
api_key |
ApiKeySchema |
|
optional |
ApiKeySchema
Type |
Description |
Notes |
str |
|
|
path_params
RequestPathParams
Name |
Type |
Description |
Notes |
petId |
PetIdSchema |
|
|
PetIdSchema
Type |
Description |
Notes |
int |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
400 |
ApiResponseFor400 |
Invalid pet value |
ApiResponseFor400
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
void (empty response body)
Authorization
petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
find_pets_by_status
[Pet] find_pets_by_status(status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.pet import Pet
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP message signature: http_signature_test
# The HTTP Signature Header mechanism that can be used by a client to
# authenticate the sender of a message and ensure that particular headers
# have not been modified in transit.
#
# You can specify the signing key-id, private key path, signing scheme,
# signing algorithm, list of signed headers and signature max validity.
# The 'key_id' parameter is an opaque string that the API server can use
# to lookup the client and validate the signature.
# The 'private_key_path' parameter should be the path to a file that
# contains a DER or base-64 encoded private key.
# The 'private_key_passphrase' parameter is optional. Set the passphrase
# if the private key is encrypted.
# The 'signed_headers' parameter is used to specify the list of
# HTTP headers included when generating the signature for the message.
# You can specify HTTP headers that you want to protect with a cryptographic
# signature. Note that proxies may add, modify or remove HTTP headers
# for legitimate reasons, so you should only add headers that you know
# will not be modified. For example, if you want to protect the HTTP request
# body, you can specify the Digest header. In that case, the client calculates
# the digest of the HTTP request body and includes the digest in the message
# signature.
# The 'signature_max_validity' parameter is optional. It is configured as a
# duration to express when the signature ceases to be valid. The client calculates
# the expiration date every time it generates the cryptographic signature
# of an HTTP request. The API server may have its own security policy
# that controls the maximum validity of the signature. The client max validity
# must be lower than the server max validity.
# The time on the client and server must be synchronized, otherwise the
# server may reject the client signature.
#
# The client must use a combination of private key, signing scheme,
# signing algorithm and hash algorithm that matches the security policy of
# the API server.
#
# See petstore_api.signing for a list of all supported parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2",
signing_info = petstore_api.signing.HttpSigningConfiguration(
key_id = 'my-key-id',
private_key_path = 'private_key.pem',
private_key_passphrase = 'YOUR_PASSPHRASE',
signing_scheme = petstore_api.signing.SCHEME_HS2019,
signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3,
hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256,
signed_headers = [
petstore_api.signing.HEADER_REQUEST_TARGET,
petstore_api.signing.HEADER_CREATED,
petstore_api.signing.HEADER_EXPIRES,
petstore_api.signing.HEADER_HOST,
petstore_api.signing.HEADER_DATE,
petstore_api.signing.HEADER_DIGEST,
'Content-Type',
'Content-Length',
'User-Agent'
],
signature_max_validity = datetime.timedelta(minutes=5)
)
)
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
query_params = {
'status': [
"available"
],
}
try:
# Finds Pets by status
api_response = api_instance.find_pets_by_status(
query_params=query_params,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
query_params |
RequestQueryParams |
|
|
accept_content_types |
typing.Tuple[str] |
default is ('application/xml', 'application/json', ) |
Tells the server the content type(s) that are accepted by the client |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
query_params
RequestQueryParams
Name |
Type |
Description |
Notes |
status |
StatusSchema |
|
|
StatusSchema
Type |
Description |
Notes |
[str] |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
200 |
ApiResponseFor200 |
successful operation |
400 |
ApiResponseFor400 |
Invalid status value |
ApiResponseFor200
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] |
|
|
headers |
Unset |
headers were not defined |
|
SchemaFor200ResponseBodyApplicationXml
Type |
Description |
Notes |
[Pet] |
|
|
SchemaFor200ResponseBodyApplicationJson
Type |
Description |
Notes |
[Pet] |
|
|
ApiResponseFor400
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
[Pet]
Authorization
http_signature_test, petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
find_pets_by_tags
[Pet] find_pets_by_tags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.pet import Pet
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP message signature: http_signature_test
# The HTTP Signature Header mechanism that can be used by a client to
# authenticate the sender of a message and ensure that particular headers
# have not been modified in transit.
#
# You can specify the signing key-id, private key path, signing scheme,
# signing algorithm, list of signed headers and signature max validity.
# The 'key_id' parameter is an opaque string that the API server can use
# to lookup the client and validate the signature.
# The 'private_key_path' parameter should be the path to a file that
# contains a DER or base-64 encoded private key.
# The 'private_key_passphrase' parameter is optional. Set the passphrase
# if the private key is encrypted.
# The 'signed_headers' parameter is used to specify the list of
# HTTP headers included when generating the signature for the message.
# You can specify HTTP headers that you want to protect with a cryptographic
# signature. Note that proxies may add, modify or remove HTTP headers
# for legitimate reasons, so you should only add headers that you know
# will not be modified. For example, if you want to protect the HTTP request
# body, you can specify the Digest header. In that case, the client calculates
# the digest of the HTTP request body and includes the digest in the message
# signature.
# The 'signature_max_validity' parameter is optional. It is configured as a
# duration to express when the signature ceases to be valid. The client calculates
# the expiration date every time it generates the cryptographic signature
# of an HTTP request. The API server may have its own security policy
# that controls the maximum validity of the signature. The client max validity
# must be lower than the server max validity.
# The time on the client and server must be synchronized, otherwise the
# server may reject the client signature.
#
# The client must use a combination of private key, signing scheme,
# signing algorithm and hash algorithm that matches the security policy of
# the API server.
#
# See petstore_api.signing for a list of all supported parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2",
signing_info = petstore_api.signing.HttpSigningConfiguration(
key_id = 'my-key-id',
private_key_path = 'private_key.pem',
private_key_passphrase = 'YOUR_PASSPHRASE',
signing_scheme = petstore_api.signing.SCHEME_HS2019,
signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3,
hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256,
signed_headers = [
petstore_api.signing.HEADER_REQUEST_TARGET,
petstore_api.signing.HEADER_CREATED,
petstore_api.signing.HEADER_EXPIRES,
petstore_api.signing.HEADER_HOST,
petstore_api.signing.HEADER_DATE,
petstore_api.signing.HEADER_DIGEST,
'Content-Type',
'Content-Length',
'User-Agent'
],
signature_max_validity = datetime.timedelta(minutes=5)
)
)
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
query_params = {
'tags': [
"tags_example"
],
}
try:
# Finds Pets by tags
api_response = api_instance.find_pets_by_tags(
query_params=query_params,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
query_params |
RequestQueryParams |
|
|
accept_content_types |
typing.Tuple[str] |
default is ('application/xml', 'application/json', ) |
Tells the server the content type(s) that are accepted by the client |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
query_params
RequestQueryParams
Name |
Type |
Description |
Notes |
tags |
TagsSchema |
|
|
TagsSchema
Type |
Description |
Notes |
[str] |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
200 |
ApiResponseFor200 |
successful operation |
400 |
ApiResponseFor400 |
Invalid tag value |
ApiResponseFor200
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] |
|
|
headers |
Unset |
headers were not defined |
|
SchemaFor200ResponseBodyApplicationXml
Type |
Description |
Notes |
[Pet] |
|
|
SchemaFor200ResponseBodyApplicationJson
Type |
Description |
Notes |
[Pet] |
|
|
ApiResponseFor400
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
[Pet]
Authorization
http_signature_test, petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
get_pet_by_id
Pet get_pet_by_id(pet_id)
Find pet by ID
Returns a single pet
Example
- Api Key Authentication (api_key):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.pet import Pet
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: api_key
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
path_params = {
'petId': 1,
}
try:
# Find pet by ID
api_response = api_instance.get_pet_by_id(
path_params=path_params,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
path_params |
RequestPathParams |
|
|
accept_content_types |
typing.Tuple[str] |
default is ('application/xml', 'application/json', ) |
Tells the server the content type(s) that are accepted by the client |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
path_params
RequestPathParams
Name |
Type |
Description |
Notes |
petId |
PetIdSchema |
|
|
PetIdSchema
Type |
Description |
Notes |
int |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
200 |
ApiResponseFor200 |
successful operation |
400 |
ApiResponseFor400 |
Invalid ID supplied |
404 |
ApiResponseFor404 |
Pet not found |
ApiResponseFor200
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] |
|
|
headers |
Unset |
headers were not defined |
|
SchemaFor200ResponseBodyApplicationXml
Type |
Description |
Notes |
Pet |
|
|
SchemaFor200ResponseBodyApplicationJson
Type |
Description |
Notes |
Pet |
|
|
ApiResponseFor400
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
ApiResponseFor404
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
Pet
Authorization
api_key
[Back to top] [Back to API list] [Back to Model list] [Back to README]
update_pet
update_pet(pet)
Update an existing pet
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.pet import Pet
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP message signature: http_signature_test
# The HTTP Signature Header mechanism that can be used by a client to
# authenticate the sender of a message and ensure that particular headers
# have not been modified in transit.
#
# You can specify the signing key-id, private key path, signing scheme,
# signing algorithm, list of signed headers and signature max validity.
# The 'key_id' parameter is an opaque string that the API server can use
# to lookup the client and validate the signature.
# The 'private_key_path' parameter should be the path to a file that
# contains a DER or base-64 encoded private key.
# The 'private_key_passphrase' parameter is optional. Set the passphrase
# if the private key is encrypted.
# The 'signed_headers' parameter is used to specify the list of
# HTTP headers included when generating the signature for the message.
# You can specify HTTP headers that you want to protect with a cryptographic
# signature. Note that proxies may add, modify or remove HTTP headers
# for legitimate reasons, so you should only add headers that you know
# will not be modified. For example, if you want to protect the HTTP request
# body, you can specify the Digest header. In that case, the client calculates
# the digest of the HTTP request body and includes the digest in the message
# signature.
# The 'signature_max_validity' parameter is optional. It is configured as a
# duration to express when the signature ceases to be valid. The client calculates
# the expiration date every time it generates the cryptographic signature
# of an HTTP request. The API server may have its own security policy
# that controls the maximum validity of the signature. The client max validity
# must be lower than the server max validity.
# The time on the client and server must be synchronized, otherwise the
# server may reject the client signature.
#
# The client must use a combination of private key, signing scheme,
# signing algorithm and hash algorithm that matches the security policy of
# the API server.
#
# See petstore_api.signing for a list of all supported parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2",
signing_info = petstore_api.signing.HttpSigningConfiguration(
key_id = 'my-key-id',
private_key_path = 'private_key.pem',
private_key_passphrase = 'YOUR_PASSPHRASE',
signing_scheme = petstore_api.signing.SCHEME_HS2019,
signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3,
hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256,
signed_headers = [
petstore_api.signing.HEADER_REQUEST_TARGET,
petstore_api.signing.HEADER_CREATED,
petstore_api.signing.HEADER_EXPIRES,
petstore_api.signing.HEADER_HOST,
petstore_api.signing.HEADER_DATE,
petstore_api.signing.HEADER_DIGEST,
'Content-Type',
'Content-Length',
'User-Agent'
],
signature_max_validity = datetime.timedelta(minutes=5)
)
)
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
body = Pet(
id=1,
category=Category(
id=1,
name="default-name",
),
name="doggie",
photo_urls=[
"photo_urls_example"
],
tags=[
Tag(
id=1,
name="name_example",
)
],
status="available",
)
try:
# Update an existing pet
api_response = api_instance.update_pet(
body=body,
)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->update_pet: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
body |
typing.Union[SchemaForRequestBodyApplicationJson, SchemaForRequestBodyApplicationXml] |
required |
|
content_type |
str |
optional, default is 'application/json' |
Selects the schema and serialization of the request body |
host_index |
typing.Optional[int] |
default is None |
Allows one to select a different host |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
body
SchemaForRequestBodyApplicationJson
Type |
Description |
Notes |
Pet |
|
|
SchemaForRequestBodyApplicationXml
Type |
Description |
Notes |
Pet |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
400 |
ApiResponseFor400 |
Invalid ID supplied |
404 |
ApiResponseFor404 |
Pet not found |
405 |
ApiResponseFor405 |
Validation exception |
ApiResponseFor400
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
ApiResponseFor404
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
ApiResponseFor405
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
void (empty response body)
Authorization
http_signature_test, petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
update_pet_with_form
update_pet_with_form(pet_id)
Updates a pet in the store with form data
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
path_params = {
'petId': 1,
}
try:
# Updates a pet in the store with form data
api_response = api_instance.update_pet_with_form(
path_params=path_params,
)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
# example passing only optional values
path_params = {
'petId': 1,
}
body = dict(
name="name_example",
status="status_example",
)
try:
# Updates a pet in the store with form data
api_response = api_instance.update_pet_with_form(
path_params=path_params,
body=body,
)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
body |
typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] |
optional, default is unset |
|
path_params |
RequestPathParams |
|
|
content_type |
str |
optional, default is 'application/x-www-form-urlencoded' |
Selects the schema and serialization of the request body |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
body
SchemaForRequestBodyApplicationXWwwFormUrlencoded
Properties
Name |
Type |
Description |
Notes |
name |
str |
Updated name of the pet |
[optional] |
status |
str |
Updated status of the pet |
[optional] |
any string name |
bool, date, datetime, dict, float, int, list, str, none_type |
any string name can be used but the value must be the correct type |
[optional] |
path_params
RequestPathParams
Name |
Type |
Description |
Notes |
petId |
PetIdSchema |
|
|
PetIdSchema
Type |
Description |
Notes |
int |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
405 |
ApiResponseFor405 |
Invalid input |
ApiResponseFor405
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
Unset |
body was not defined |
|
headers |
Unset |
headers were not defined |
|
void (empty response body)
Authorization
petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
upload_file_with_required_file
ApiResponse upload_file_with_required_file(pet_id)
uploads an image (required)
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.api_response import ApiResponse
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
path_params = {
'petId': 1,
}
try:
# uploads an image (required)
api_response = api_instance.upload_file_with_required_file(
path_params=path_params,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
# example passing only optional values
path_params = {
'petId': 1,
}
body = dict(
additional_metadata="additional_metadata_example",
required_file=open('/path/to/file', 'rb'),
)
try:
# uploads an image (required)
api_response = api_instance.upload_file_with_required_file(
path_params=path_params,
body=body,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
body |
typing.Union[SchemaForRequestBodyMultipartFormData, Unset] |
optional, default is unset |
|
path_params |
RequestPathParams |
|
|
content_type |
str |
optional, default is 'multipart/form-data' |
Selects the schema and serialization of the request body |
accept_content_types |
typing.Tuple[str] |
default is ('application/json', ) |
Tells the server the content type(s) that are accepted by the client |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
body
SchemaForRequestBodyMultipartFormData
Properties
Name |
Type |
Description |
Notes |
additionalMetadata |
str |
Additional data to pass to server |
[optional] |
requiredFile |
file_type |
file to upload |
|
any string name |
bool, date, datetime, dict, float, int, list, str, none_type |
any string name can be used but the value must be the correct type |
[optional] |
path_params
RequestPathParams
Name |
Type |
Description |
Notes |
petId |
PetIdSchema |
|
|
PetIdSchema
Type |
Description |
Notes |
int |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
200 |
ApiResponseFor200 |
successful operation |
ApiResponseFor200
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
typing.Union[SchemaFor200ResponseBodyApplicationJson, ] |
|
|
headers |
Unset |
headers were not defined |
|
SchemaFor200ResponseBodyApplicationJson
ApiResponse
Authorization
petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]
upload_image
ApiResponse upload_image(pet_id)
uploads an image
Example
- OAuth Authentication (petstore_auth):
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model.api_response import ApiResponse
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
# example passing only required values which don't have defaults set
path_params = {
'petId': 1,
}
try:
# uploads an image
api_response = api_instance.upload_image(
path_params=path_params,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->upload_image: %s\n" % e)
# example passing only optional values
path_params = {
'petId': 1,
}
body = dict(
additional_metadata="additional_metadata_example",
file=open('/path/to/file', 'rb'),
)
try:
# uploads an image
api_response = api_instance.upload_image(
path_params=path_params,
body=body,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling PetApi->upload_image: %s\n" % e)
Parameters
Name |
Type |
Description |
Notes |
body |
typing.Union[SchemaForRequestBodyMultipartFormData, Unset] |
optional, default is unset |
|
path_params |
RequestPathParams |
|
|
content_type |
str |
optional, default is 'multipart/form-data' |
Selects the schema and serialization of the request body |
accept_content_types |
typing.Tuple[str] |
default is ('application/json', ) |
Tells the server the content type(s) that are accepted by the client |
stream |
bool |
default is False |
if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file |
timeout |
typing.Optional[typing.Union[int, typing.Tuple]] |
default is None |
the timeout used by the rest client |
skip_deserialization |
bool |
default is False |
when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned |
body
SchemaForRequestBodyMultipartFormData
Properties
Name |
Type |
Description |
Notes |
additionalMetadata |
str |
Additional data to pass to server |
[optional] |
file |
file_type |
file to upload |
[optional] |
any string name |
bool, date, datetime, dict, float, int, list, str, none_type |
any string name can be used but the value must be the correct type |
[optional] |
path_params
RequestPathParams
Name |
Type |
Description |
Notes |
petId |
PetIdSchema |
|
|
PetIdSchema
Type |
Description |
Notes |
int |
|
|
Return Types, Responses
Code |
Class |
Description |
n/a |
api_client.ApiResponseWithoutDeserialization |
When skip_deserialization is True this response is returned |
200 |
ApiResponseFor200 |
successful operation |
ApiResponseFor200
Name |
Type |
Description |
Notes |
response |
urllib3.HTTPResponse |
Raw response |
|
body |
typing.Union[SchemaFor200ResponseBodyApplicationJson, ] |
|
|
headers |
Unset |
headers were not defined |
|
SchemaFor200ResponseBodyApplicationJson
ApiResponse
Authorization
petstore_auth
[Back to top] [Back to API list] [Back to Model list] [Back to README]