All Downloads are FREE. Search and download functionalities are using the official Maven repository.

htmlDocs2.sample_python.mustache Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
from __future__ import print_statement
import time
import {{{pythonPackageName}}}
from {{{pythonPackageName}}}.rest import ApiException
from pprint import pprint
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
# Configure HTTP basic authorization: {{{name}}}
{{{pythonPackageName}}}.configuration.username = 'YOUR_USERNAME'
{{{pythonPackageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
# Configure API key authorization: {{{name}}}
{{{pythonPackageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# {{{pythonPackageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
{{{pythonPackageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}

# create an instance of the API class
api_instance = {{{pythonPackageName}}}.{{{classname}}}()
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{unescapedDescription}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}

try: 
{{#summary}}    # {{{.}}}
{{/summary}}    {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationIdSnakeCase}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
    pprint(api_response){{/returnType}}
except ApiException as e:
    print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy