forked from loafle/openapi-generator-original
[python] Cleanup ThreadPool with atexit rather than __del__ (#5094)
* [python] Cleanup ThreadPool with atexit rather than __del__ This removes the `__del__` function from the generated Python client, and replaces it with a `cleanup` function. When a ThreadPool is created, the cleanup function is registered with the `atexit` module. This fixes #5093, where the API client could hang indefinitely at garbage collection. * Update petstore examples * Test to ensure threadpool is cleaned up * Docs now encourage using the context manager * Regenerate docs * Update samples
This commit is contained in:
committed by
GitHub
parent
d627282e89
commit
15345e1620
@@ -2,6 +2,7 @@
|
|||||||
{{>partial_header}}
|
{{>partial_header}}
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import atexit
|
||||||
import datetime
|
import datetime
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import json
|
import json
|
||||||
@@ -75,11 +76,19 @@ class ApiClient(object):
|
|||||||
self.user_agent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}'
|
self.user_agent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}'
|
||||||
self.client_side_validation = configuration.client_side_validation
|
self.client_side_validation = configuration.client_side_validation
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -87,6 +96,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -8,22 +8,26 @@ from pprint import pprint
|
|||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
# Defining host is optional and default to {{{basePath}}}
|
# Defining host is optional and default to {{{basePath}}}
|
||||||
configuration.host = "{{{basePath}}}"
|
configuration.host = "{{{basePath}}}"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration))
|
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
# Create an instance of the API class
|
||||||
{{/allParams}}
|
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
|
||||||
|
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/allParams}}
|
||||||
{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
{{^hasAuthMethods}}
|
{{^hasAuthMethods}}
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = {{{packageName}}}.{{{classname}}}()
|
with {{{packageName}}}.ApiClient() as api_client:
|
||||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
# Create an instance of the API class
|
||||||
{{/allParams}}
|
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
|
||||||
|
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/allParams}}
|
||||||
{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
{{#summary}} # {{{.}}}
|
{{#summary}} # {{{.}}}
|
||||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
||||||
pprint(api_response){{/returnType}}
|
pprint(api_response){{/returnType}}
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -8,18 +8,20 @@ from pprint import pprint
|
|||||||
{{> python_doc_auth_partial}}
|
{{> python_doc_auth_partial}}
|
||||||
# Defining host is optional and default to {{{basePath}}}
|
# Defining host is optional and default to {{{basePath}}}
|
||||||
configuration.host = "{{{basePath}}}"
|
configuration.host = "{{{basePath}}}"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration))
|
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
# Create an instance of the API class
|
||||||
{{/allParams}}
|
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
|
||||||
|
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
{{#summary}} # {{{.}}}
|
{{#summary}} # {{{.}}}
|
||||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
||||||
pprint(api_response){{/returnType}}
|
pprint(api_response){{/returnType}}
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
||||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|||||||
@@ -7,18 +7,20 @@ from pprint import pprint
|
|||||||
{{> python_doc_auth_partial}}
|
{{> python_doc_auth_partial}}
|
||||||
# Defining host is optional and default to {{{basePath}}}
|
# Defining host is optional and default to {{{basePath}}}
|
||||||
configuration.host = "{{{basePath}}}"
|
configuration.host = "{{{basePath}}}"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration))
|
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
# Create an instance of the API class
|
||||||
{{/allParams}}
|
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
|
||||||
|
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
{{#summary}} # {{{.}}}
|
{{#summary}} # {{{.}}}
|
||||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
||||||
pprint(api_response){{/returnType}}
|
pprint(api_response){{/returnType}}
|
||||||
except {{{packageName}}}.ApiException as e:
|
except {{{packageName}}}.ApiException as e:
|
||||||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
||||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import atexit
|
||||||
import mimetypes
|
import mimetypes
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
import os
|
import os
|
||||||
@@ -74,11 +75,19 @@ class ApiClient(object):
|
|||||||
# Set default User-Agent.
|
# Set default User-Agent.
|
||||||
self.user_agent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}'
|
self.user_agent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}'
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -86,6 +95,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -7,51 +7,55 @@ from pprint import pprint
|
|||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
# Defining host is optional and default to {{{basePath}}}
|
# Defining host is optional and default to {{{basePath}}}
|
||||||
configuration.host = "{{{basePath}}}"
|
configuration.host = "{{{basePath}}}"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration))
|
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
|
||||||
{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
{{^hasAuthMethods}}
|
{{^hasAuthMethods}}
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = {{{packageName}}}.{{{classname}}}()
|
with {{{packageName}}}.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
|
||||||
{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
{{#requiredParams}}{{^defaultValue}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
{{#requiredParams}}{{^defaultValue}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
||||||
{{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}
|
{{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}
|
||||||
{{/optionalParams}}
|
{{/optionalParams}}
|
||||||
{{#requiredParams}}
|
{{#requiredParams}}
|
||||||
{{^hasMore}}
|
{{^hasMore}}
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
{{#summary}} # {{{.}}}
|
{{#summary}} # {{{.}}}
|
||||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/defaultValue}}{{/requiredParams}}){{#returnType}}
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/defaultValue}}{{/requiredParams}}){{#returnType}}
|
||||||
pprint(api_response){{/returnType}}
|
pprint(api_response){{/returnType}}
|
||||||
except {{{packageName}}}.ApiException as e:
|
except {{{packageName}}}.ApiException as e:
|
||||||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
||||||
{{/hasMore}}
|
{{/hasMore}}
|
||||||
{{/requiredParams}}
|
{{/requiredParams}}
|
||||||
{{#optionalParams}}
|
{{#optionalParams}}
|
||||||
{{^hasMore}}
|
{{^hasMore}}
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
{{#summary}} # {{{.}}}
|
{{#summary}} # {{{.}}}
|
||||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}}={{paramName}}{{#hasMore}}, {{/hasMore}}{{/optionalParams}}){{#returnType}}
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}}={{paramName}}{{#hasMore}}, {{/hasMore}}{{/optionalParams}}){{#returnType}}
|
||||||
pprint(api_response){{/returnType}}
|
pprint(api_response){{/returnType}}
|
||||||
except {{{packageName}}}.ApiException as e:
|
except {{{packageName}}}.ApiException as e:
|
||||||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
||||||
{{/hasMore}}
|
{{/hasMore}}
|
||||||
{{/optionalParams}}
|
{{/optionalParams}}
|
||||||
{{^requiredParams}}
|
{{^requiredParams}}
|
||||||
{{^optionalParams}}
|
{{^optionalParams}}
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
{{#summary}} # {{{.}}}
|
{{#summary}} # {{{.}}}
|
||||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}(){{#returnType}}
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}(){{#returnType}}
|
||||||
pprint(api_response){{/returnType}}
|
pprint(api_response){{/returnType}}
|
||||||
except {{{packageName}}}.ApiException as e:
|
except {{{packageName}}}.ApiException as e:
|
||||||
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
||||||
{{/optionalParams}}
|
{{/optionalParams}}
|
||||||
{{/requiredParams}}
|
{{/requiredParams}}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -54,15 +54,17 @@ from pprint import pprint
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -23,15 +23,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# creates an XmlItem
|
# creates an XmlItem
|
||||||
api_instance.create_xml_item(xml_item)
|
api_instance.create_xml_item(xml_item)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -89,14 +91,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = True # bool | Input boolean as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = True # bool | Input boolean as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -142,14 +146,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -195,14 +201,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 3.4 # float | Input number as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 3.4 # float | Input number as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -248,14 +256,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 'body_example' # str | Input string as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 'body_example' # str | Input string as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -301,13 +311,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_file_schema(body)
|
api_instance.test_body_with_file_schema(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -351,14 +363,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
query = 'query_example' # str |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
query = 'query_example' # str |
|
||||||
body = petstore_api.User() # User |
|
body = petstore_api.User() # User |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_query_params(query, body)
|
api_instance.test_body_with_query_params(query, body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -405,15 +419,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test \"client\" model
|
# To test \"client\" model
|
||||||
api_response = api_instance.test_client_model(body)
|
api_response = api_instance.test_client_model(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -466,9 +482,11 @@ configuration.password = 'YOUR_PASSWORD'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
number = 3.4 # float | None
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
number = 3.4 # float | None
|
||||||
double = 3.4 # float | None
|
double = 3.4 # float | None
|
||||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||||
byte = 'byte_example' # str | None
|
byte = 'byte_example' # str | None
|
||||||
@@ -483,10 +501,10 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
|||||||
password = 'password_example' # str | None (optional)
|
password = 'password_example' # str | None (optional)
|
||||||
param_callback = 'param_callback_example' # str | None (optional)
|
param_callback = 'param_callback_example' # str | None (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -546,9 +564,11 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
||||||
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
||||||
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
||||||
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
||||||
@@ -557,10 +577,10 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
|
|||||||
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
||||||
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test enum parameters
|
# To test enum parameters
|
||||||
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -614,19 +634,21 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
required_string_group = 56 # int | Required String in group parameters
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
required_string_group = 56 # int | Required String in group parameters
|
||||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||||
required_int64_group = 56 # int | Required Integer in group parameters
|
required_int64_group = 56 # int | Required Integer in group parameters
|
||||||
string_group = 56 # int | String in group parameters (optional)
|
string_group = 56 # int | String in group parameters (optional)
|
||||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||||
int64_group = 56 # int | Integer in group parameters (optional)
|
int64_group = 56 # int | Integer in group parameters (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -675,14 +697,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = {'key': 'param_example'} # dict(str, str) | request body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = {'key': 'param_example'} # dict(str, str) | request body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test inline additionalProperties
|
# test inline additionalProperties
|
||||||
api_instance.test_inline_additional_properties(param)
|
api_instance.test_inline_additional_properties(param)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -726,15 +750,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = 'param_example' # str | field1
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = 'param_example' # str | field1
|
||||||
param2 = 'param2_example' # str | field2
|
param2 = 'param2_example' # str | field2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test json serialization of form data
|
# test json serialization of form data
|
||||||
api_instance.test_json_form_data(param, param2)
|
api_instance.test_json_form_data(param, param2)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -781,17 +807,19 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
pipe = ['pipe_example'] # list[str] |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
pipe = ['pipe_example'] # list[str] |
|
||||||
ioutil = ['ioutil_example'] # list[str] |
|
ioutil = ['ioutil_example'] # list[str] |
|
||||||
http = ['http_example'] # list[str] |
|
http = ['http_example'] # list[str] |
|
||||||
url = ['url_example'] # list[str] |
|
url = ['url_example'] # list[str] |
|
||||||
context = ['context_example'] # list[str] |
|
context = ['context_example'] # list[str] |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,17 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
api_response = api_instance.test_classname(body)
|
api_response = api_instance.test_classname(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -35,14 +35,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
api_instance.add_pet(body)
|
api_instance.add_pet(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -93,15 +95,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | Pet id to delete
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | Pet id to delete
|
||||||
api_key = 'api_key_example' # str | (optional)
|
api_key = 'api_key_example' # str | (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -155,15 +159,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
api_response = api_instance.find_pets_by_status(status)
|
api_response = api_instance.find_pets_by_status(status)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -216,15 +222,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
tags = ['tags_example'] # list[str] | Tags to filter by
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
tags = ['tags_example'] # list[str] | Tags to filter by
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
api_response = api_instance.find_pets_by_tags(tags)
|
api_response = api_instance.find_pets_by_tags(tags)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -279,15 +287,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to return
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
api_response = api_instance.get_pet_by_id(pet_id)
|
api_response = api_instance.get_pet_by_id(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -339,14 +349,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
api_instance.update_pet(body)
|
api_instance.update_pet(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -399,16 +411,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet that needs to be updated
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet that needs to be updated
|
||||||
name = 'name_example' # str | Updated name of the pet (optional)
|
name = 'name_example' # str | Updated name of the pet (optional)
|
||||||
status = 'status_example' # str | Updated status of the pet (optional)
|
status = 'status_example' # str | Updated status of the pet (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -460,17 +474,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
file = '/path/to/file' # file | file to upload (optional)
|
file = '/path/to/file' # file | file to upload (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -522,17 +538,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
required_file = '/path/to/file' # file | file to upload
|
required_file = '/path/to/file' # file | file to upload
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
api_instance.delete_order(order_id)
|
api_instance.delete_order(order_id)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -88,14 +90,16 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
api_response = api_instance.get_inventory()
|
api_response = api_instance.get_inventory()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -138,15 +142,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 56 # int | ID of pet that needs to be fetched
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 56 # int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
api_response = api_instance.get_order_by_id(order_id)
|
api_response = api_instance.get_order_by_id(order_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -192,15 +198,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
api_response = api_instance.place_order(body)
|
api_response = api_instance.place_order(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.User() # User | Created user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = petstore_api.User() # User | Created user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create user
|
# Create user
|
||||||
api_instance.create_user(body)
|
api_instance.create_user(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_user: %s\n" % e)
|
print("Exception when calling UserApi->create_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -81,14 +83,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_array_input(body)
|
api_instance.create_users_with_array_input(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -132,14 +136,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_list_input(body)
|
api_instance.create_users_with_list_input(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -185,14 +191,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete user
|
# Delete user
|
||||||
api_instance.delete_user(username)
|
api_instance.delete_user(username)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -237,15 +245,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
api_response = api_instance.get_user_by_name(username)
|
api_response = api_instance.get_user_by_name(username)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -291,16 +301,18 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The user name for login
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The user name for login
|
||||||
password = 'password_example' # str | The password for login in clear text
|
password = 'password_example' # str | The password for login in clear text
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
api_response = api_instance.login_user(username, password)
|
api_response = api_instance.login_user(username, password)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->login_user: %s\n" % e)
|
print("Exception when calling UserApi->login_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,13 +358,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
api_instance.logout_user()
|
api_instance.logout_user()
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -395,15 +409,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | name that need to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | name that need to be deleted
|
||||||
body = petstore_api.User() # User | Updated user object
|
body = petstore_api.User() # User | Updated user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updated user
|
# Updated user
|
||||||
api_instance.update_user(username, body)
|
api_instance.update_user(username, body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->update_user: %s\n" % e)
|
print("Exception when calling UserApi->update_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import atexit
|
||||||
import datetime
|
import datetime
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import json
|
import json
|
||||||
@@ -80,11 +81,19 @@ class ApiClient(object):
|
|||||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||||
self.client_side_validation = configuration.client_side_validation
|
self.client_side_validation = configuration.client_side_validation
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -92,6 +101,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -53,15 +53,17 @@ from pprint import pprint
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -22,16 +22,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -36,15 +36,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
xml_item = petstore_api.XmlItem() # xml_item.XmlItem | XmlItem Body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
xml_item = petstore_api.XmlItem() # xml_item.XmlItem | XmlItem Body
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# creates an XmlItem
|
# creates an XmlItem
|
||||||
api_instance.create_xml_item(xml_item)
|
api_instance.create_xml_item(xml_item)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -89,16 +91,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = True # bool | Input boolean as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = True # bool | Input boolean as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -143,16 +147,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -197,16 +203,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_enum_serialize(body=body)
|
api_response = api_instance.fake_outer_enum_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_enum_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_enum_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -251,16 +259,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -305,16 +315,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = 'body_example' # str | Input string as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 'body_example' # str | Input string as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -359,14 +371,16 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass |
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_file_schema(body)
|
api_instance.test_body_with_file_schema(body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -409,15 +423,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
query = 'query_example' # str |
|
# Create an instance of the API class
|
||||||
body = petstore_api.User() # user.User |
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
query = 'query_example' # str |
|
||||||
|
body = petstore_api.User() # user.User |
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_query_params(query, body)
|
api_instance.test_body_with_query_params(query, body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -463,16 +479,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# To test \"client\" model
|
# To test \"client\" model
|
||||||
api_response = api_instance.test_client_model(body)
|
api_response = api_instance.test_client_model(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -517,13 +535,15 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
api_instance.test_endpoint_enums_length_one()
|
api_instance.test_endpoint_enums_length_one()
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_enums_length_one: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_enums_length_one: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -579,13 +599,15 @@ configuration.password = 'YOUR_PASSWORD'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
number = 3.4 # float | None
|
# Create an instance of the API class
|
||||||
double = 3.4 # float | None
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
number = 3.4 # float | None
|
||||||
byte = 'byte_example' # str | None
|
double = 3.4 # float | None
|
||||||
integer = 56 # int | None (optional)
|
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||||
|
byte = 'byte_example' # str | None
|
||||||
|
integer = 56 # int | None (optional)
|
||||||
int32 = 56 # int | None (optional)
|
int32 = 56 # int | None (optional)
|
||||||
int64 = 56 # int | None (optional)
|
int64 = 56 # int | None (optional)
|
||||||
float = 3.4 # float | None (optional)
|
float = 3.4 # float | None (optional)
|
||||||
@@ -596,19 +618,19 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
|||||||
password = 'password_example' # str | None (optional)
|
password = 'password_example' # str | None (optional)
|
||||||
param_callback = 'param_callback_example' # str | None (optional)
|
param_callback = 'param_callback_example' # str | None (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -667,9 +689,11 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional)
|
||||||
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
||||||
enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional)
|
enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional)
|
||||||
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
||||||
@@ -678,12 +702,12 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
|
|||||||
enum_form_string_array = '$' # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of '$'
|
enum_form_string_array = '$' # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of '$'
|
||||||
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# To test enum parameters
|
# To test enum parameters
|
||||||
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -736,28 +760,30 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
required_string_group = 56 # int | Required String in group parameters
|
# Create an instance of the API class
|
||||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
required_int64_group = 56 # int | Required Integer in group parameters
|
required_string_group = 56 # int | Required String in group parameters
|
||||||
string_group = 56 # int | String in group parameters (optional)
|
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||||
|
required_int64_group = 56 # int | Required Integer in group parameters
|
||||||
|
string_group = 56 # int | String in group parameters (optional)
|
||||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||||
int64_group = 56 # int | Integer in group parameters (optional)
|
int64_group = 56 # int | Integer in group parameters (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -805,15 +831,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
param = {'key': 'param_example'} # {str: (str,)} | request body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = {'key': 'param_example'} # {str: (str,)} | request body
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# test inline additionalProperties
|
# test inline additionalProperties
|
||||||
api_instance.test_inline_additional_properties(param)
|
api_instance.test_inline_additional_properties(param)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -856,16 +884,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
param = 'param_example' # str | field1
|
# Create an instance of the API class
|
||||||
param2 = 'param2_example' # str | field2
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = 'param_example' # str | field1
|
||||||
|
param2 = 'param2_example' # str | field2
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# test json serialization of form data
|
# test json serialization of form data
|
||||||
api_instance.test_json_form_data(param, param2)
|
api_instance.test_json_form_data(param, param2)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,16 +30,18 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
|
||||||
|
body = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
api_response = api_instance.test_classname(body)
|
api_response = api_instance.test_classname(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -34,15 +34,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
api_instance.add_pet(body)
|
api_instance.add_pet(body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -92,24 +94,26 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | Pet id to delete
|
# Create an instance of the API class
|
||||||
api_key = 'api_key_example' # str | (optional)
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | Pet id to delete
|
||||||
|
api_key = 'api_key_example' # str | (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id)
|
api_instance.delete_pet(pet_id)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -162,16 +166,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
status = ['status_example'] # [str] | Status values that need to be considered for filter
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
status = ['status_example'] # [str] | Status values that need to be considered for filter
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
api_response = api_instance.find_pets_by_status(status)
|
api_response = api_instance.find_pets_by_status(status)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -223,16 +229,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
tags = ['tags_example'] # [str] | Tags to filter by
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
tags = ['tags_example'] # [str] | Tags to filter by
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
api_response = api_instance.find_pets_by_tags(tags)
|
api_response = api_instance.find_pets_by_tags(tags)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -286,16 +294,18 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to return
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to return
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
api_response = api_instance.get_pet_by_id(pet_id)
|
api_response = api_instance.get_pet_by_id(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,15 +356,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
api_instance.update_pet(body)
|
api_instance.update_pet(body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -406,25 +418,27 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet that needs to be updated
|
# Create an instance of the API class
|
||||||
name = 'name_example' # str | Updated name of the pet (optional)
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet that needs to be updated
|
||||||
|
name = 'name_example' # str | Updated name of the pet (optional)
|
||||||
status = 'status_example' # str | Updated status of the pet (optional)
|
status = 'status_example' # str | Updated status of the pet (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id)
|
api_instance.update_pet_with_form(pet_id)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -475,28 +489,30 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
|
file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
|
||||||
files = open('/path/to/file', 'rb') # [file_type] | files to upload (optional)
|
files = open('/path/to/file', 'rb') # [file_type] | files to upload (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id)
|
api_response = api_instance.upload_file(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file, files=files)
|
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file, files=files)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -548,27 +564,29 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
required_file = open('/path/to/file', 'rb') # file_type | file to upload
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
pet_id = 56 # int | ID of pet to update
|
||||||
|
required_file = open('/path/to/file', 'rb') # file_type | file to upload
|
||||||
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
api_instance.delete_order(order_id)
|
api_instance.delete_order(order_id)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -87,15 +89,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
api_response = api_instance.get_inventory()
|
api_response = api_instance.get_inventory()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -137,16 +141,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
order_id = 56 # int | ID of pet that needs to be fetched
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 56 # int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
api_response = api_instance.get_order_by_id(order_id)
|
api_response = api_instance.get_order_by_id(order_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -191,16 +197,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Order() # order.Order | order placed for purchasing the pet
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
body = petstore_api.Order() # order.Order | order placed for purchasing the pet
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
api_response = api_instance.place_order(body)
|
api_response = api_instance.place_order(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.User() # user.User | Created user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = petstore_api.User() # user.User | Created user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Create user
|
# Create user
|
||||||
api_instance.create_user(body)
|
api_instance.create_user(body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->create_user: %s\n" % e)
|
print("Exception when calling UserApi->create_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -80,15 +82,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = [petstore_api.User()] # [user.User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # [user.User] | List of user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_array_input(body)
|
api_instance.create_users_with_array_input(body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -131,15 +135,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = [petstore_api.User()] # [user.User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # [user.User] | List of user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_list_input(body)
|
api_instance.create_users_with_list_input(body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -184,15 +190,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be deleted
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Delete user
|
# Delete user
|
||||||
api_instance.delete_user(username)
|
api_instance.delete_user(username)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -236,16 +244,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
api_response = api_instance.get_user_by_name(username)
|
api_response = api_instance.get_user_by_name(username)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -290,17 +300,19 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | The user name for login
|
# Create an instance of the API class
|
||||||
password = 'password_example' # str | The password for login in clear text
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The user name for login
|
||||||
|
password = 'password_example' # str | The password for login in clear text
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
api_response = api_instance.login_user(username, password)
|
api_response = api_instance.login_user(username, password)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->login_user: %s\n" % e)
|
print("Exception when calling UserApi->login_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -345,14 +357,16 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
api_instance.logout_user()
|
api_instance.logout_user()
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -394,16 +408,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | name that need to be deleted
|
# Create an instance of the API class
|
||||||
body = petstore_api.User() # user.User | Updated user object
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | name that need to be deleted
|
||||||
|
body = petstore_api.User() # user.User | Updated user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Updated user
|
# Updated user
|
||||||
api_instance.update_user(username, body)
|
api_instance.update_user(username, body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->update_user: %s\n" % e)
|
print("Exception when calling UserApi->update_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import atexit
|
||||||
import mimetypes
|
import mimetypes
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
import os
|
import os
|
||||||
@@ -79,11 +80,19 @@ class ApiClient(object):
|
|||||||
# Set default User-Agent.
|
# Set default User-Agent.
|
||||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -91,6 +100,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ $ nosetests -v
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import atexit
|
||||||
|
import weakref
|
||||||
import unittest
|
import unittest
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
|
|
||||||
@@ -199,3 +201,17 @@ class ApiClientTests(unittest.TestCase):
|
|||||||
model = petstore_api.StringBooleanMap(**model_dict)
|
model = petstore_api.StringBooleanMap(**model_dict)
|
||||||
result = self.api_client.sanitize_for_serialization(model)
|
result = self.api_client.sanitize_for_serialization(model)
|
||||||
self.assertEqual(result, model_dict)
|
self.assertEqual(result, model_dict)
|
||||||
|
|
||||||
|
def test_context_manager_closes_threadpool(self):
|
||||||
|
with petstore_api.ApiClient() as client:
|
||||||
|
self.assertIsNotNone(client.pool)
|
||||||
|
pool_ref = weakref.ref(client._pool)
|
||||||
|
self.assertIsNotNone(pool_ref())
|
||||||
|
self.assertIsNone(pool_ref())
|
||||||
|
|
||||||
|
def test_atexit_closes_threadpool(self):
|
||||||
|
client = petstore_api.ApiClient()
|
||||||
|
self.assertIsNotNone(client.pool)
|
||||||
|
self.assertIsNotNone(client._pool)
|
||||||
|
atexit._run_exitfuncs()
|
||||||
|
self.assertIsNone(client._pool)
|
||||||
|
|||||||
@@ -54,15 +54,17 @@ from pprint import pprint
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -23,15 +23,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# creates an XmlItem
|
# creates an XmlItem
|
||||||
api_instance.create_xml_item(xml_item)
|
api_instance.create_xml_item(xml_item)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -89,14 +91,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = True # bool | Input boolean as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = True # bool | Input boolean as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -142,14 +146,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -195,14 +201,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 3.4 # float | Input number as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 3.4 # float | Input number as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -248,14 +256,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 'body_example' # str | Input string as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 'body_example' # str | Input string as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -301,13 +311,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_file_schema(body)
|
api_instance.test_body_with_file_schema(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -351,14 +363,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
query = 'query_example' # str |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
query = 'query_example' # str |
|
||||||
body = petstore_api.User() # User |
|
body = petstore_api.User() # User |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_query_params(query, body)
|
api_instance.test_body_with_query_params(query, body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -405,15 +419,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test \"client\" model
|
# To test \"client\" model
|
||||||
api_response = api_instance.test_client_model(body)
|
api_response = api_instance.test_client_model(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -466,9 +482,11 @@ configuration.password = 'YOUR_PASSWORD'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
number = 3.4 # float | None
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
number = 3.4 # float | None
|
||||||
double = 3.4 # float | None
|
double = 3.4 # float | None
|
||||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||||
byte = 'byte_example' # str | None
|
byte = 'byte_example' # str | None
|
||||||
@@ -483,10 +501,10 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
|||||||
password = 'password_example' # str | None (optional)
|
password = 'password_example' # str | None (optional)
|
||||||
param_callback = 'param_callback_example' # str | None (optional)
|
param_callback = 'param_callback_example' # str | None (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -546,9 +564,11 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
||||||
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
||||||
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
||||||
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
||||||
@@ -557,10 +577,10 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
|
|||||||
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
||||||
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test enum parameters
|
# To test enum parameters
|
||||||
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -614,19 +634,21 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
required_string_group = 56 # int | Required String in group parameters
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
required_string_group = 56 # int | Required String in group parameters
|
||||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||||
required_int64_group = 56 # int | Required Integer in group parameters
|
required_int64_group = 56 # int | Required Integer in group parameters
|
||||||
string_group = 56 # int | String in group parameters (optional)
|
string_group = 56 # int | String in group parameters (optional)
|
||||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||||
int64_group = 56 # int | Integer in group parameters (optional)
|
int64_group = 56 # int | Integer in group parameters (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -675,14 +697,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = {'key': 'param_example'} # dict(str, str) | request body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = {'key': 'param_example'} # dict(str, str) | request body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test inline additionalProperties
|
# test inline additionalProperties
|
||||||
api_instance.test_inline_additional_properties(param)
|
api_instance.test_inline_additional_properties(param)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -726,15 +750,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = 'param_example' # str | field1
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = 'param_example' # str | field1
|
||||||
param2 = 'param2_example' # str | field2
|
param2 = 'param2_example' # str | field2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test json serialization of form data
|
# test json serialization of form data
|
||||||
api_instance.test_json_form_data(param, param2)
|
api_instance.test_json_form_data(param, param2)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -781,17 +807,19 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
pipe = ['pipe_example'] # list[str] |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
pipe = ['pipe_example'] # list[str] |
|
||||||
ioutil = ['ioutil_example'] # list[str] |
|
ioutil = ['ioutil_example'] # list[str] |
|
||||||
http = ['http_example'] # list[str] |
|
http = ['http_example'] # list[str] |
|
||||||
url = ['url_example'] # list[str] |
|
url = ['url_example'] # list[str] |
|
||||||
context = ['context_example'] # list[str] |
|
context = ['context_example'] # list[str] |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,17 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
api_response = api_instance.test_classname(body)
|
api_response = api_instance.test_classname(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -35,14 +35,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
api_instance.add_pet(body)
|
api_instance.add_pet(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -93,15 +95,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | Pet id to delete
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | Pet id to delete
|
||||||
api_key = 'api_key_example' # str | (optional)
|
api_key = 'api_key_example' # str | (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -155,15 +159,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
api_response = api_instance.find_pets_by_status(status)
|
api_response = api_instance.find_pets_by_status(status)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -216,15 +222,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
tags = ['tags_example'] # list[str] | Tags to filter by
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
tags = ['tags_example'] # list[str] | Tags to filter by
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
api_response = api_instance.find_pets_by_tags(tags)
|
api_response = api_instance.find_pets_by_tags(tags)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -279,15 +287,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to return
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
api_response = api_instance.get_pet_by_id(pet_id)
|
api_response = api_instance.get_pet_by_id(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -339,14 +349,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
api_instance.update_pet(body)
|
api_instance.update_pet(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -399,16 +411,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet that needs to be updated
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet that needs to be updated
|
||||||
name = 'name_example' # str | Updated name of the pet (optional)
|
name = 'name_example' # str | Updated name of the pet (optional)
|
||||||
status = 'status_example' # str | Updated status of the pet (optional)
|
status = 'status_example' # str | Updated status of the pet (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -460,17 +474,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
file = '/path/to/file' # file | file to upload (optional)
|
file = '/path/to/file' # file | file to upload (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -522,17 +538,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
required_file = '/path/to/file' # file | file to upload
|
required_file = '/path/to/file' # file | file to upload
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
api_instance.delete_order(order_id)
|
api_instance.delete_order(order_id)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -88,14 +90,16 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
api_response = api_instance.get_inventory()
|
api_response = api_instance.get_inventory()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -138,15 +142,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 56 # int | ID of pet that needs to be fetched
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 56 # int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
api_response = api_instance.get_order_by_id(order_id)
|
api_response = api_instance.get_order_by_id(order_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -192,15 +198,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
api_response = api_instance.place_order(body)
|
api_response = api_instance.place_order(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.User() # User | Created user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = petstore_api.User() # User | Created user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create user
|
# Create user
|
||||||
api_instance.create_user(body)
|
api_instance.create_user(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_user: %s\n" % e)
|
print("Exception when calling UserApi->create_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -81,14 +83,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_array_input(body)
|
api_instance.create_users_with_array_input(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -132,14 +136,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_list_input(body)
|
api_instance.create_users_with_list_input(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -185,14 +191,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete user
|
# Delete user
|
||||||
api_instance.delete_user(username)
|
api_instance.delete_user(username)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -237,15 +245,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
api_response = api_instance.get_user_by_name(username)
|
api_response = api_instance.get_user_by_name(username)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -291,16 +301,18 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The user name for login
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The user name for login
|
||||||
password = 'password_example' # str | The password for login in clear text
|
password = 'password_example' # str | The password for login in clear text
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
api_response = api_instance.login_user(username, password)
|
api_response = api_instance.login_user(username, password)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->login_user: %s\n" % e)
|
print("Exception when calling UserApi->login_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,13 +358,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
api_instance.logout_user()
|
api_instance.logout_user()
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -395,15 +409,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | name that need to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | name that need to be deleted
|
||||||
body = petstore_api.User() # User | Updated user object
|
body = petstore_api.User() # User | Updated user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updated user
|
# Updated user
|
||||||
api_instance.update_user(username, body)
|
api_instance.update_user(username, body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->update_user: %s\n" % e)
|
print("Exception when calling UserApi->update_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import atexit
|
||||||
import datetime
|
import datetime
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import json
|
import json
|
||||||
@@ -81,11 +82,19 @@ class ApiClient(object):
|
|||||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||||
self.client_side_validation = configuration.client_side_validation
|
self.client_side_validation = configuration.client_side_validation
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -93,6 +102,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -54,15 +54,17 @@ from pprint import pprint
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -23,15 +23,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(body)
|
api_response = api_instance.call_123_test_special_tags(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# creates an XmlItem
|
# creates an XmlItem
|
||||||
api_instance.create_xml_item(xml_item)
|
api_instance.create_xml_item(xml_item)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -89,14 +91,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = True # bool | Input boolean as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = True # bool | Input boolean as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -142,14 +146,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
api_response = api_instance.fake_outer_composite_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -195,14 +201,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 3.4 # float | Input number as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 3.4 # float | Input number as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -248,14 +256,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 'body_example' # str | Input string as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 'body_example' # str | Input string as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -301,13 +311,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_file_schema(body)
|
api_instance.test_body_with_file_schema(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -351,14 +363,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
query = 'query_example' # str |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
query = 'query_example' # str |
|
||||||
body = petstore_api.User() # User |
|
body = petstore_api.User() # User |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_query_params(query, body)
|
api_instance.test_body_with_query_params(query, body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -405,15 +419,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test \"client\" model
|
# To test \"client\" model
|
||||||
api_response = api_instance.test_client_model(body)
|
api_response = api_instance.test_client_model(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -466,9 +482,11 @@ configuration.password = 'YOUR_PASSWORD'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
number = 3.4 # float | None
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
number = 3.4 # float | None
|
||||||
double = 3.4 # float | None
|
double = 3.4 # float | None
|
||||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||||
byte = 'byte_example' # str | None
|
byte = 'byte_example' # str | None
|
||||||
@@ -483,10 +501,10 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
|||||||
password = 'password_example' # str | None (optional)
|
password = 'password_example' # str | None (optional)
|
||||||
param_callback = 'param_callback_example' # str | None (optional)
|
param_callback = 'param_callback_example' # str | None (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -546,9 +564,11 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
||||||
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
||||||
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
||||||
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
||||||
@@ -557,10 +577,10 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
|
|||||||
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
||||||
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test enum parameters
|
# To test enum parameters
|
||||||
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -614,19 +634,21 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
required_string_group = 56 # int | Required String in group parameters
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
required_string_group = 56 # int | Required String in group parameters
|
||||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||||
required_int64_group = 56 # int | Required Integer in group parameters
|
required_int64_group = 56 # int | Required Integer in group parameters
|
||||||
string_group = 56 # int | String in group parameters (optional)
|
string_group = 56 # int | String in group parameters (optional)
|
||||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||||
int64_group = 56 # int | Integer in group parameters (optional)
|
int64_group = 56 # int | Integer in group parameters (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -675,14 +697,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = {'key': 'param_example'} # dict(str, str) | request body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = {'key': 'param_example'} # dict(str, str) | request body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test inline additionalProperties
|
# test inline additionalProperties
|
||||||
api_instance.test_inline_additional_properties(param)
|
api_instance.test_inline_additional_properties(param)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -726,15 +750,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = 'param_example' # str | field1
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = 'param_example' # str | field1
|
||||||
param2 = 'param2_example' # str | field2
|
param2 = 'param2_example' # str | field2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test json serialization of form data
|
# test json serialization of form data
|
||||||
api_instance.test_json_form_data(param, param2)
|
api_instance.test_json_form_data(param, param2)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -781,17 +807,19 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
pipe = ['pipe_example'] # list[str] |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
pipe = ['pipe_example'] # list[str] |
|
||||||
ioutil = ['ioutil_example'] # list[str] |
|
ioutil = ['ioutil_example'] # list[str] |
|
||||||
http = ['http_example'] # list[str] |
|
http = ['http_example'] # list[str] |
|
||||||
url = ['url_example'] # list[str] |
|
url = ['url_example'] # list[str] |
|
||||||
context = ['context_example'] # list[str] |
|
context = ['context_example'] # list[str] |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,17 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
|
||||||
|
body = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
api_response = api_instance.test_classname(body)
|
api_response = api_instance.test_classname(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -35,14 +35,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
api_instance.add_pet(body)
|
api_instance.add_pet(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -93,15 +95,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | Pet id to delete
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | Pet id to delete
|
||||||
api_key = 'api_key_example' # str | (optional)
|
api_key = 'api_key_example' # str | (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -155,15 +159,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
api_response = api_instance.find_pets_by_status(status)
|
api_response = api_instance.find_pets_by_status(status)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -216,15 +222,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
tags = ['tags_example'] # list[str] | Tags to filter by
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
tags = ['tags_example'] # list[str] | Tags to filter by
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
api_response = api_instance.find_pets_by_tags(tags)
|
api_response = api_instance.find_pets_by_tags(tags)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -279,15 +287,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to return
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
api_response = api_instance.get_pet_by_id(pet_id)
|
api_response = api_instance.get_pet_by_id(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -339,14 +349,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
api_instance.update_pet(body)
|
api_instance.update_pet(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -399,16 +411,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet that needs to be updated
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet that needs to be updated
|
||||||
name = 'name_example' # str | Updated name of the pet (optional)
|
name = 'name_example' # str | Updated name of the pet (optional)
|
||||||
status = 'status_example' # str | Updated status of the pet (optional)
|
status = 'status_example' # str | Updated status of the pet (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -460,17 +474,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
file = '/path/to/file' # file | file to upload (optional)
|
file = '/path/to/file' # file | file to upload (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -522,17 +538,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
required_file = '/path/to/file' # file | file to upload
|
required_file = '/path/to/file' # file | file to upload
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
api_instance.delete_order(order_id)
|
api_instance.delete_order(order_id)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -88,14 +90,16 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
api_response = api_instance.get_inventory()
|
api_response = api_instance.get_inventory()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -138,15 +142,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 56 # int | ID of pet that needs to be fetched
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 56 # int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
api_response = api_instance.get_order_by_id(order_id)
|
api_response = api_instance.get_order_by_id(order_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -192,15 +198,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
body = petstore_api.Order() # Order | order placed for purchasing the pet
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
api_response = api_instance.place_order(body)
|
api_response = api_instance.place_order(body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = petstore_api.User() # User | Created user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = petstore_api.User() # User | Created user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create user
|
# Create user
|
||||||
api_instance.create_user(body)
|
api_instance.create_user(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_user: %s\n" % e)
|
print("Exception when calling UserApi->create_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -81,14 +83,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_array_input(body)
|
api_instance.create_users_with_array_input(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -132,14 +136,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
body = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_list_input(body)
|
api_instance.create_users_with_list_input(body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -185,14 +191,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete user
|
# Delete user
|
||||||
api_instance.delete_user(username)
|
api_instance.delete_user(username)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -237,15 +245,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
api_response = api_instance.get_user_by_name(username)
|
api_response = api_instance.get_user_by_name(username)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -291,16 +301,18 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The user name for login
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The user name for login
|
||||||
password = 'password_example' # str | The password for login in clear text
|
password = 'password_example' # str | The password for login in clear text
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
api_response = api_instance.login_user(username, password)
|
api_response = api_instance.login_user(username, password)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->login_user: %s\n" % e)
|
print("Exception when calling UserApi->login_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,13 +358,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
api_instance.logout_user()
|
api_instance.logout_user()
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -395,15 +409,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | name that need to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | name that need to be deleted
|
||||||
body = petstore_api.User() # User | Updated user object
|
body = petstore_api.User() # User | Updated user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updated user
|
# Updated user
|
||||||
api_instance.update_user(username, body)
|
api_instance.update_user(username, body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->update_user: %s\n" % e)
|
print("Exception when calling UserApi->update_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import atexit
|
||||||
import datetime
|
import datetime
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import json
|
import json
|
||||||
@@ -80,11 +81,19 @@ class ApiClient(object):
|
|||||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||||
self.client_side_validation = configuration.client_side_validation
|
self.client_side_validation = configuration.client_side_validation
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -92,6 +101,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ $ nosetests -v
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import atexit
|
||||||
|
import weakref
|
||||||
import unittest
|
import unittest
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
|
|
||||||
@@ -169,3 +171,17 @@ class ApiClientTests(unittest.TestCase):
|
|||||||
data = [pet]
|
data = [pet]
|
||||||
result = self.api_client.sanitize_for_serialization(data)
|
result = self.api_client.sanitize_for_serialization(data)
|
||||||
self.assertEqual(result, list_of_pet_dict)
|
self.assertEqual(result, list_of_pet_dict)
|
||||||
|
|
||||||
|
def test_context_manager_closes_threadpool(self):
|
||||||
|
with petstore_api.ApiClient() as client:
|
||||||
|
self.assertIsNotNone(client.pool)
|
||||||
|
pool_ref = weakref.ref(client._pool)
|
||||||
|
self.assertIsNotNone(pool_ref())
|
||||||
|
self.assertIsNone(pool_ref())
|
||||||
|
|
||||||
|
def test_atexit_closes_threadpool(self):
|
||||||
|
client = petstore_api.ApiClient()
|
||||||
|
self.assertIsNotNone(client.pool)
|
||||||
|
self.assertIsNotNone(client._pool)
|
||||||
|
atexit._run_exitfuncs()
|
||||||
|
self.assertIsNone(client._pool)
|
||||||
|
|||||||
@@ -53,15 +53,17 @@ from pprint import pprint
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
client_client = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
client_client = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(client_client)
|
api_response = api_instance.call_123_test_special_tags(client_client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -22,16 +22,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
client_client = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
client_client = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(client_client)
|
api_response = api_instance.call_123_test_special_tags(client_client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,16 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.DefaultApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.DefaultApi(api_client)
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.foo_get()
|
api_response = api_instance.foo_get()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling DefaultApi->foo_get: %s\n" % e)
|
print("Exception when calling DefaultApi->foo_get: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -33,15 +33,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
# Health check endpoint
|
# Health check endpoint
|
||||||
api_response = api_instance.fake_health_get()
|
api_response = api_instance.fake_health_get()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_health_get: %s\n" % e)
|
print("Exception when calling FakeApi->fake_health_get: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -83,16 +85,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = True # bool | Input boolean as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = True # bool | Input boolean as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -137,16 +141,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
outer_composite_outer_composite = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
outer_composite_outer_composite = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_composite_serialize(outer_composite_outer_composite=outer_composite_outer_composite)
|
api_response = api_instance.fake_outer_composite_serialize(outer_composite_outer_composite=outer_composite_outer_composite)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -191,16 +197,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = 3.4 # float | Input number as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 3.4 # float | Input number as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -245,16 +253,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
body = 'body_example' # str | Input string as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 'body_example' # str | Input string as post body (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -299,14 +309,16 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
file_schema_test_class_file_schema_test_class = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
file_schema_test_class_file_schema_test_class = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass |
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_file_schema(file_schema_test_class_file_schema_test_class)
|
api_instance.test_body_with_file_schema(file_schema_test_class_file_schema_test_class)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -349,15 +361,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
query = 'query_example' # str |
|
# Create an instance of the API class
|
||||||
user_user = petstore_api.User() # user.User |
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
query = 'query_example' # str |
|
||||||
|
user_user = petstore_api.User() # user.User |
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_query_params(query, user_user)
|
api_instance.test_body_with_query_params(query, user_user)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -403,16 +417,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
client_client = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
client_client = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# To test \"client\" model
|
# To test \"client\" model
|
||||||
api_response = api_instance.test_client_model(client_client)
|
api_response = api_instance.test_client_model(client_client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -464,13 +480,15 @@ configuration.password = 'YOUR_PASSWORD'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
number = 3.4 # float | None
|
# Create an instance of the API class
|
||||||
double = 3.4 # float | None
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
number = 3.4 # float | None
|
||||||
byte = 'byte_example' # str | None
|
double = 3.4 # float | None
|
||||||
integer = 56 # int | None (optional)
|
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||||
|
byte = 'byte_example' # str | None
|
||||||
|
integer = 56 # int | None (optional)
|
||||||
int32 = 56 # int | None (optional)
|
int32 = 56 # int | None (optional)
|
||||||
int64 = 56 # int | None (optional)
|
int64 = 56 # int | None (optional)
|
||||||
float = 3.4 # float | None (optional)
|
float = 3.4 # float | None (optional)
|
||||||
@@ -481,19 +499,19 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
|||||||
password = 'password_example' # str | None (optional)
|
password = 'password_example' # str | None (optional)
|
||||||
param_callback = 'param_callback_example' # str | None (optional)
|
param_callback = 'param_callback_example' # str | None (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -552,9 +570,11 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional)
|
||||||
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
||||||
enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional)
|
enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional)
|
||||||
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
||||||
@@ -563,12 +583,12 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
|
|||||||
enum_form_string_array = '$' # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of '$'
|
enum_form_string_array = '$' # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of '$'
|
||||||
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# To test enum parameters
|
# To test enum parameters
|
||||||
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -627,28 +647,30 @@ configuration.access_token = 'YOUR_BEARER_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
required_string_group = 56 # int | Required String in group parameters
|
# Create an instance of the API class
|
||||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
required_int64_group = 56 # int | Required Integer in group parameters
|
required_string_group = 56 # int | Required String in group parameters
|
||||||
string_group = 56 # int | String in group parameters (optional)
|
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||||
|
required_int64_group = 56 # int | Required Integer in group parameters
|
||||||
|
string_group = 56 # int | String in group parameters (optional)
|
||||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||||
int64_group = 56 # int | Integer in group parameters (optional)
|
int64_group = 56 # int | Integer in group parameters (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -696,15 +718,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
request_body = {'key': 'request_body_example'} # {str: (str,)} | request body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
request_body = {'key': 'request_body_example'} # {str: (str,)} | request body
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# test inline additionalProperties
|
# test inline additionalProperties
|
||||||
api_instance.test_inline_additional_properties(request_body)
|
api_instance.test_inline_additional_properties(request_body)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -747,16 +771,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
param = 'param_example' # str | field1
|
# Create an instance of the API class
|
||||||
param2 = 'param2_example' # str | field2
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = 'param_example' # str | field1
|
||||||
|
param2 = 'param2_example' # str | field2
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# test json serialization of form data
|
# test json serialization of form data
|
||||||
api_instance.test_json_form_data(param, param2)
|
api_instance.test_json_form_data(param, param2)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -802,18 +828,20 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pipe = ['pipe_example'] # [str] |
|
# Create an instance of the API class
|
||||||
ioutil = ['ioutil_example'] # [str] |
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
http = ['http_example'] # [str] |
|
pipe = ['pipe_example'] # [str] |
|
||||||
url = ['url_example'] # [str] |
|
ioutil = ['ioutil_example'] # [str] |
|
||||||
context = ['context_example'] # [str] |
|
http = ['http_example'] # [str] |
|
||||||
|
url = ['url_example'] # [str] |
|
||||||
|
context = ['context_example'] # [str] |
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,16 +30,18 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
client_client = petstore_api.Client() # client.Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
|
||||||
|
client_client = petstore_api.Client() # client.Client | client model
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
api_response = api_instance.test_classname(client_client)
|
api_response = api_instance.test_classname(client_client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -55,15 +55,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
api_instance.add_pet(pet_pet)
|
api_instance.add_pet(pet_pet)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -112,24 +114,26 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | Pet id to delete
|
# Create an instance of the API class
|
||||||
api_key = 'api_key_example' # str | (optional)
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | Pet id to delete
|
||||||
|
api_key = 'api_key_example' # str | (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id)
|
api_instance.delete_pet(pet_id)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -202,16 +206,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
status = ['status_example'] # [str] | Status values that need to be considered for filter
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
status = ['status_example'] # [str] | Status values that need to be considered for filter
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
api_response = api_instance.find_pets_by_status(status)
|
api_response = api_instance.find_pets_by_status(status)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -284,16 +290,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
tags = ['tags_example'] # [str] | Tags to filter by
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
tags = ['tags_example'] # [str] | Tags to filter by
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
api_response = api_instance.find_pets_by_tags(tags)
|
api_response = api_instance.find_pets_by_tags(tags)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -347,16 +355,18 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to return
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to return
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
api_response = api_instance.get_pet_by_id(pet_id)
|
api_response = api_instance.get_pet_by_id(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -428,15 +438,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
api_instance.update_pet(pet_pet)
|
api_instance.update_pet(pet_pet)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -487,25 +499,27 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet that needs to be updated
|
# Create an instance of the API class
|
||||||
name = 'name_example' # str | Updated name of the pet (optional)
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet that needs to be updated
|
||||||
|
name = 'name_example' # str | Updated name of the pet (optional)
|
||||||
status = 'status_example' # str | Updated status of the pet (optional)
|
status = 'status_example' # str | Updated status of the pet (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id)
|
api_instance.update_pet_with_form(pet_id)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -556,27 +570,29 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
|
file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id)
|
api_response = api_instance.upload_file(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -627,27 +643,29 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
required_file = open('/path/to/file', 'rb') # file_type | file to upload
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
pet_id = 56 # int | ID of pet to update
|
||||||
|
required_file = open('/path/to/file', 'rb') # file_type | file to upload
|
||||||
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
# and optional values
|
# and optional values
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
api_instance.delete_order(order_id)
|
api_instance.delete_order(order_id)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -87,15 +89,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
api_response = api_instance.get_inventory()
|
api_response = api_instance.get_inventory()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -137,16 +141,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
order_id = 56 # int | ID of pet that needs to be fetched
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 56 # int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
api_response = api_instance.get_order_by_id(order_id)
|
api_response = api_instance.get_order_by_id(order_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -191,16 +197,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
order_order = petstore_api.Order() # order.Order | order placed for purchasing the pet
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_order = petstore_api.Order() # order.Order | order placed for purchasing the pet
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
api_response = api_instance.place_order(order_order)
|
api_response = api_instance.place_order(order_order)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
user_user = petstore_api.User() # user.User | Created user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
user_user = petstore_api.User() # user.User | Created user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Create user
|
# Create user
|
||||||
api_instance.create_user(user_user)
|
api_instance.create_user(user_user)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->create_user: %s\n" % e)
|
print("Exception when calling UserApi->create_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -80,15 +82,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
user_user = [petstore_api.User()] # [user.User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
user_user = [petstore_api.User()] # [user.User] | List of user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_array_input(user_user)
|
api_instance.create_users_with_array_input(user_user)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -131,15 +135,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
user_user = [petstore_api.User()] # [user.User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
user_user = [petstore_api.User()] # [user.User] | List of user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_list_input(user_user)
|
api_instance.create_users_with_list_input(user_user)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -184,15 +190,17 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be deleted
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Delete user
|
# Delete user
|
||||||
api_instance.delete_user(username)
|
api_instance.delete_user(username)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -236,16 +244,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
api_response = api_instance.get_user_by_name(username)
|
api_response = api_instance.get_user_by_name(username)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -290,17 +300,19 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | The user name for login
|
# Create an instance of the API class
|
||||||
password = 'password_example' # str | The password for login in clear text
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The user name for login
|
||||||
|
password = 'password_example' # str | The password for login in clear text
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
api_response = api_instance.login_user(username, password)
|
api_response = api_instance.login_user(username, password)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->login_user: %s\n" % e)
|
print("Exception when calling UserApi->login_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -345,14 +357,16 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
|
||||||
# example, this endpoint has no required or optional parameters
|
# example, this endpoint has no required or optional parameters
|
||||||
try:
|
try:
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
api_instance.logout_user()
|
api_instance.logout_user()
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -394,16 +408,18 @@ import time
|
|||||||
import petstore_api
|
import petstore_api
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
username = 'username_example' # str | name that need to be deleted
|
# Create an instance of the API class
|
||||||
user_user = petstore_api.User() # user.User | Updated user object
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | name that need to be deleted
|
||||||
|
user_user = petstore_api.User() # user.User | Updated user object
|
||||||
|
|
||||||
# example passing only required values which don't have defaults set
|
# example passing only required values which don't have defaults set
|
||||||
try:
|
try:
|
||||||
# Updated user
|
# Updated user
|
||||||
api_instance.update_user(username, user_user)
|
api_instance.update_user(username, user_user)
|
||||||
except petstore_api.ApiException as e:
|
except petstore_api.ApiException as e:
|
||||||
print("Exception when calling UserApi->update_user: %s\n" % e)
|
print("Exception when calling UserApi->update_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import atexit
|
||||||
import mimetypes
|
import mimetypes
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import ThreadPool
|
||||||
import os
|
import os
|
||||||
@@ -79,11 +80,19 @@ class ApiClient(object):
|
|||||||
# Set default User-Agent.
|
# Set default User-Agent.
|
||||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -91,6 +100,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
@@ -54,15 +54,17 @@ from pprint import pprint
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
client = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
client = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(client)
|
api_response = api_instance.call_123_test_special_tags(client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -23,15 +23,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.AnotherFakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
client = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.AnotherFakeApi(api_client)
|
||||||
|
client = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test special tags
|
# To test special tags
|
||||||
api_response = api_instance.call_123_test_special_tags(client)
|
api_response = api_instance.call_123_test_special_tags(client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.DefaultApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.DefaultApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.foo_get()
|
api_response = api_instance.foo_get()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling DefaultApi->foo_get: %s\n" % e)
|
print("Exception when calling DefaultApi->foo_get: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Health check endpoint
|
# Health check endpoint
|
||||||
api_response = api_instance.fake_health_get()
|
api_response = api_instance.fake_health_get()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_health_get: %s\n" % e)
|
print("Exception when calling FakeApi->fake_health_get: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -84,14 +86,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = True # bool | Input boolean as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = True # bool | Input boolean as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
api_response = api_instance.fake_outer_boolean_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -137,14 +141,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
outer_composite = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
outer_composite = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_composite_serialize(outer_composite=outer_composite)
|
api_response = api_instance.fake_outer_composite_serialize(outer_composite=outer_composite)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -190,14 +196,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 3.4 # float | Input number as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 3.4 # float | Input number as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_number_serialize(body=body)
|
api_response = api_instance.fake_outer_number_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -243,14 +251,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
body = 'body_example' # str | Input string as post body (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
body = 'body_example' # str | Input string as post body (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_response = api_instance.fake_outer_string_serialize(body=body)
|
api_response = api_instance.fake_outer_string_serialize(body=body)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -296,13 +306,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_file_schema(file_schema_test_class)
|
api_instance.test_body_with_file_schema(file_schema_test_class)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,14 +358,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
query = 'query_example' # str |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
query = 'query_example' # str |
|
||||||
user = petstore_api.User() # User |
|
user = petstore_api.User() # User |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_body_with_query_params(query, user)
|
api_instance.test_body_with_query_params(query, user)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -400,15 +414,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
client = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
client = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test \"client\" model
|
# To test \"client\" model
|
||||||
api_response = api_instance.test_client_model(client)
|
api_response = api_instance.test_client_model(client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -461,9 +477,11 @@ configuration.password = 'YOUR_PASSWORD'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
number = 3.4 # float | None
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
number = 3.4 # float | None
|
||||||
double = 3.4 # float | None
|
double = 3.4 # float | None
|
||||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||||
byte = 'byte_example' # str | None
|
byte = 'byte_example' # str | None
|
||||||
@@ -478,10 +496,10 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
|||||||
password = 'password_example' # str | None (optional)
|
password = 'password_example' # str | None (optional)
|
||||||
param_callback = 'param_callback_example' # str | None (optional)
|
param_callback = 'param_callback_example' # str | None (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -541,9 +559,11 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
|
||||||
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
|
||||||
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
|
||||||
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
|
||||||
@@ -552,10 +572,10 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
|
|||||||
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
|
||||||
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test enum parameters
|
# To test enum parameters
|
||||||
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -615,19 +635,21 @@ configuration.access_token = 'YOUR_BEARER_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
required_string_group = 56 # int | Required String in group parameters
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
required_string_group = 56 # int | Required String in group parameters
|
||||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||||
required_int64_group = 56 # int | Required Integer in group parameters
|
required_int64_group = 56 # int | Required Integer in group parameters
|
||||||
string_group = 56 # int | String in group parameters (optional)
|
string_group = 56 # int | String in group parameters (optional)
|
||||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||||
int64_group = 56 # int | Integer in group parameters (optional)
|
int64_group = 56 # int | Integer in group parameters (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fake endpoint to test group parameters (optional)
|
# Fake endpoint to test group parameters (optional)
|
||||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -676,14 +698,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
request_body = {'key': 'request_body_example'} # dict(str, str) | request body
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
request_body = {'key': 'request_body_example'} # dict(str, str) | request body
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test inline additionalProperties
|
# test inline additionalProperties
|
||||||
api_instance.test_inline_additional_properties(request_body)
|
api_instance.test_inline_additional_properties(request_body)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -727,15 +751,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
param = 'param_example' # str | field1
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
param = 'param_example' # str | field1
|
||||||
param2 = 'param2_example' # str | field2
|
param2 = 'param2_example' # str | field2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# test json serialization of form data
|
# test json serialization of form data
|
||||||
api_instance.test_json_form_data(param, param2)
|
api_instance.test_json_form_data(param, param2)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -782,17 +808,19 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
pipe = ['pipe_example'] # list[str] |
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeApi(api_client)
|
||||||
|
pipe = ['pipe_example'] # list[str] |
|
||||||
ioutil = ['ioutil_example'] # list[str] |
|
ioutil = ['ioutil_example'] # list[str] |
|
||||||
http = ['http_example'] # list[str] |
|
http = ['http_example'] # list[str] |
|
||||||
url = ['url_example'] # list[str] |
|
url = ['url_example'] # list[str] |
|
||||||
context = ['context_example'] # list[str] |
|
context = ['context_example'] # list[str] |
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,17 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
client = petstore_api.Client() # Client | client model
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
|
||||||
|
client = petstore_api.Client() # Client | client model
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# To test class name in snake case
|
# To test class name in snake case
|
||||||
api_response = api_instance.test_classname(client)
|
api_response = api_instance.test_classname(client)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -35,14 +35,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
api_instance.add_pet(pet)
|
api_instance.add_pet(pet)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
print("Exception when calling PetApi->add_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -92,15 +94,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | Pet id to delete
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | Pet id to delete
|
||||||
api_key = 'api_key_example' # str | (optional)
|
api_key = 'api_key_example' # str | (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
api_instance.delete_pet(pet_id, api_key=api_key)
|
api_instance.delete_pet(pet_id, api_key=api_key)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
print("Exception when calling PetApi->delete_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -153,15 +157,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
status = ['status_example'] # list[str] | Status values that need to be considered for filter
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
api_response = api_instance.find_pets_by_status(status)
|
api_response = api_instance.find_pets_by_status(status)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -214,15 +220,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
tags = ['tags_example'] # list[str] | Tags to filter by
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
tags = ['tags_example'] # list[str] | Tags to filter by
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
api_response = api_instance.find_pets_by_tags(tags)
|
api_response = api_instance.find_pets_by_tags(tags)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -277,15 +285,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to return
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
api_response = api_instance.get_pet_by_id(pet_id)
|
api_response = api_instance.get_pet_by_id(pet_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -337,14 +347,16 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
api_instance.update_pet(pet)
|
api_instance.update_pet(pet)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
print("Exception when calling PetApi->update_pet: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -396,16 +408,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet that needs to be updated
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet that needs to be updated
|
||||||
name = 'name_example' # str | Updated name of the pet (optional)
|
name = 'name_example' # str | Updated name of the pet (optional)
|
||||||
status = 'status_example' # str | Updated status of the pet (optional)
|
status = 'status_example' # str | Updated status of the pet (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
api_instance.update_pet_with_form(pet_id, name=name, status=status)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -457,17 +471,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
file = '/path/to/file' # file | file to upload (optional)
|
file = '/path/to/file' # file | file to upload (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image
|
# uploads an image
|
||||||
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -519,17 +535,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
pet_id = 56 # int | ID of pet to update
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.PetApi(api_client)
|
||||||
|
pet_id = 56 # int | ID of pet to update
|
||||||
required_file = '/path/to/file' # file | file to upload
|
required_file = '/path/to/file' # file | file to upload
|
||||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# uploads an image (required)
|
# uploads an image (required)
|
||||||
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
api_instance.delete_order(order_id)
|
api_instance.delete_order(order_id)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
print("Exception when calling StoreApi->delete_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -88,14 +90,16 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
|
|||||||
|
|
||||||
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
# Defining host is optional and default to http://petstore.swagger.io:80/v2
|
||||||
configuration.host = "http://petstore.swagger.io:80/v2"
|
configuration.host = "http://petstore.swagger.io:80/v2"
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
|
with petstore_api.ApiClient(configuration) as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
api_response = api_instance.get_inventory()
|
api_response = api_instance.get_inventory()
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -138,15 +142,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order_id = 56 # int | ID of pet that needs to be fetched
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order_id = 56 # int | ID of pet that needs to be fetched
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
api_response = api_instance.get_order_by_id(order_id)
|
api_response = api_instance.get_order_by_id(order_id)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -192,15 +198,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.StoreApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
order = petstore_api.Order() # Order | order placed for purchasing the pet
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.StoreApi(api_client)
|
||||||
|
order = petstore_api.Order() # Order | order placed for purchasing the pet
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
api_response = api_instance.place_order(order)
|
api_response = api_instance.place_order(order)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
print("Exception when calling StoreApi->place_order: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
user = petstore_api.User() # User | Created user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
user = petstore_api.User() # User | Created user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create user
|
# Create user
|
||||||
api_instance.create_user(user)
|
api_instance.create_user(user)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_user: %s\n" % e)
|
print("Exception when calling UserApi->create_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -81,14 +83,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
user = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
user = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_array_input(user)
|
api_instance.create_users_with_array_input(user)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -132,14 +136,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
user = [petstore_api.User()] # list[User] | List of user object
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
user = [petstore_api.User()] # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
api_instance.create_users_with_list_input(user)
|
api_instance.create_users_with_list_input(user)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -185,14 +191,16 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be deleted
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Delete user
|
# Delete user
|
||||||
api_instance.delete_user(username)
|
api_instance.delete_user(username)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
print("Exception when calling UserApi->delete_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -237,15 +245,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
api_response = api_instance.get_user_by_name(username)
|
api_response = api_instance.get_user_by_name(username)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -291,16 +301,18 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | The user name for login
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | The user name for login
|
||||||
password = 'password_example' # str | The password for login in clear text
|
password = 'password_example' # str | The password for login in clear text
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
api_response = api_instance.login_user(username, password)
|
api_response = api_instance.login_user(username, password)
|
||||||
pprint(api_response)
|
pprint(api_response)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->login_user: %s\n" % e)
|
print("Exception when calling UserApi->login_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,13 +358,15 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
api_instance.logout_user()
|
api_instance.logout_user()
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
print("Exception when calling UserApi->logout_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -395,15 +409,17 @@ import petstore_api
|
|||||||
from petstore_api.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# Create an instance of the API class
|
# Enter a context with an instance of the API client
|
||||||
api_instance = petstore_api.UserApi()
|
with petstore_api.ApiClient() as api_client:
|
||||||
username = 'username_example' # str | name that need to be deleted
|
# Create an instance of the API class
|
||||||
|
api_instance = petstore_api.UserApi(api_client)
|
||||||
|
username = 'username_example' # str | name that need to be deleted
|
||||||
user = petstore_api.User() # User | Updated user object
|
user = petstore_api.User() # User | Updated user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Updated user
|
# Updated user
|
||||||
api_instance.update_user(username, user)
|
api_instance.update_user(username, user)
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
print("Exception when calling UserApi->update_user: %s\n" % e)
|
print("Exception when calling UserApi->update_user: %s\n" % e)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import atexit
|
||||||
import datetime
|
import datetime
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import json
|
import json
|
||||||
@@ -80,11 +81,19 @@ class ApiClient(object):
|
|||||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||||
self.client_side_validation = configuration.client_side_validation
|
self.client_side_validation = configuration.client_side_validation
|
||||||
|
|
||||||
def __del__(self):
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
if self._pool:
|
if self._pool:
|
||||||
self._pool.close()
|
self._pool.close()
|
||||||
self._pool.join()
|
self._pool.join()
|
||||||
self._pool = None
|
self._pool = None
|
||||||
|
if hasattr(atexit, 'unregister'):
|
||||||
|
atexit.unregister(self.close)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pool(self):
|
def pool(self):
|
||||||
@@ -92,6 +101,7 @@ class ApiClient(object):
|
|||||||
avoids instantiating unused threadpool for blocking clients.
|
avoids instantiating unused threadpool for blocking clients.
|
||||||
"""
|
"""
|
||||||
if self._pool is None:
|
if self._pool is None:
|
||||||
|
atexit.register(self.close)
|
||||||
self._pool = ThreadPool(self.pool_threads)
|
self._pool = ThreadPool(self.pool_threads)
|
||||||
return self._pool
|
return self._pool
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user