You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.4 KiB
Plaintext
45 lines
1.4 KiB
Plaintext
```python
|
|
import time
|
|
from {{{packageName}}} import Configuration, ApiClient, exceptions
|
|
{{#imports}}
|
|
{{.}}
|
|
{{/imports}}
|
|
from pprint import pprint
|
|
|
|
# Set up an API client
|
|
# Read Configuration class docs for more info about parameters and authentication methods
|
|
configuration = Configuration(
|
|
host = "{{{basePath}}}",{{#hasAuthMethods}}
|
|
{{#authMethods}}
|
|
{{#isBasic}}
|
|
{{#isBasicBasic}}
|
|
username = 'YOUR_USERNAME',
|
|
password = 'YOUR_PASSWORD',
|
|
{{/isBasicBasic}}
|
|
{{/isBasic}}
|
|
{{/authMethods}}
|
|
{{/hasAuthMethods}}
|
|
)
|
|
|
|
with ApiClient(configuration) as api_client:
|
|
{{#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}}
|
|
{{/optionalParams}}
|
|
|
|
try:
|
|
{{#returnType}}(data, response) = {{/returnType}}%%%make_api_name!!!{{classname}}%%%.{{{operationId}}}({{#requiredParams}}
|
|
{{^defaultValue}}{{paramName}},{{/defaultValue}}{{/requiredParams}}{{#optionalParams}}
|
|
{{paramName}}={{paramName}},{{#-last}}
|
|
{{/-last}}{{/optionalParams}})
|
|
{{#returnType}}
|
|
pprint(data)
|
|
{{/returnType}}
|
|
except exceptions.ApiException as e:
|
|
print("Exception when calling {{classname}}.{{operationId}}: %s\n" % e)
|
|
```
|