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

python.api_doc_example.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version

```python
import {{{packageName}}}
{{#vendorExtensions.x-py-example-import}}
{{{.}}}
{{/vendorExtensions.x-py-example-import}}
from {{{packageName}}}.rest import ApiException
from pprint import pprint

{{> python_doc_auth_partial}}
# Enter a context with an instance of the API client
{{#asyncio}}async {{/asyncio}}with {{{packageName}}}.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = {{{packageName}}}.{{{classname}}}(api_client)
    {{#allParams}}
    {{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
    {{/allParams}}

    try:
        {{#summary}}
        # {{{.}}}
        {{/summary}}
        {{#returnType}}api_response = {{/returnType}}{{#asyncio}}await {{/asyncio}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}})
        {{#returnType}}
        print("The response of {{classname}}->{{operationId}}:\n")
        pprint(api_response)
        {{/returnType}}
    except Exception as e:
        print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
```

{{#vendorExtensions.x-py-postponed-example-imports.size}}
{{#vendorExtensions.x-py-postponed-example-imports}}
{{{.}}}
{{/vendorExtensions.x-py-postponed-example-imports}}
{{classname}}.update_forward_refs()
{{/vendorExtensions.x-py-postponed-example-imports.size}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy