diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java index 4c83af570fa..9988ddba425 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java @@ -414,6 +414,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements * @param pydantic pydantic imports * @param datetimeImports datetime imports * @param modelImports model imports + * @param exampleImports example imports * @param classname class name * @return pydantic type * @@ -423,6 +424,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements Set pydanticImports, Set datetimeImports, Set modelImports, + Set exampleImports, String classname) { if (cp == null) { // if codegen parameter (e.g. map/dict of undefined type) is null, default to string @@ -444,12 +446,12 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements } pydanticImports.add("conlist"); return String.format(Locale.ROOT, "conlist(%s%s)", - getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, classname), + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname), constraints); } else if (cp.isMap) { typingImports.add("Dict"); return String.format(Locale.ROOT, "Dict[str, %s]", - getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, classname)); + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname)); } else if (cp.isString || cp.isBinary || cp.isByteArray) { if (cp.hasValidation) { List fieldCustomization = new ArrayList<>(); @@ -643,6 +645,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements // add model prefix hasModelsToImport = true; modelImports.add(cp.dataType); + exampleImports.add(cp.dataType); return cp.dataType; } else if (cp.getContent() != null) { LinkedHashMap contents = cp.getContent(); @@ -650,7 +653,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements CodegenMediaType cmt = contents.get(key); // TODO process the first one only at the moment if (cmt != null) - return getPydanticType(cmt.getSchema(), typingImports, pydanticImports, datetimeImports, modelImports, classname); + return getPydanticType(cmt.getSchema(), typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname); } throw new RuntimeException("Error! Failed to process getPydanticType when getting the content: " + cp); } else { @@ -666,6 +669,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements * @param pydantic pydantic imports * @param datetimeImports datetime imports * @param modelImports model imports + * @param exampleImports example imports * @param classname class name * @return pydantic type * @@ -675,6 +679,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements Set pydanticImports, Set datetimeImports, Set modelImports, + Set exampleImports, String classname) { if (cp == null) { // if codegen property (e.g. map/dict of undefined type) is null, default to string @@ -715,11 +720,11 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements pydanticImports.add("conlist"); typingImports.add("List"); // for return type return String.format(Locale.ROOT, "conlist(%s%s)", - getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, classname), + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname), constraints); } else if (cp.isMap) { typingImports.add("Dict"); - return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, classname)); + return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, classname)); } else if (cp.isString) { if (cp.hasValidation) { List fieldCustomization = new ArrayList<>(); @@ -917,6 +922,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements // for parameter model, import directly hasModelsToImport = true; modelImports.add(cp.dataType); + exampleImports.add(cp.dataType); } else { if (circularImports.containsKey(cp.dataType)) { if (circularImports.get(cp.dataType).contains(classname)) { @@ -926,6 +932,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements // not circular import, so ok to import it hasModelsToImport = true; modelImports.add(cp.dataType); + exampleImports.add(cp.dataType); } } else { LOGGER.error("Failed to look up {} from the imports (map of set) of models.", cp.dataType); @@ -948,10 +955,11 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements OperationMap objectMap = objs.getOperations(); List operations = objectMap.getOperation(); for (CodegenOperation operation : operations) { - + TreeSet exampleImports = new TreeSet<>(); // import for each operation to be show in sample code List params = operation.allParams; + for (CodegenParameter param : params) { - String typing = getPydanticType(param, typingImports, pydanticImports, datetimeImports, modelImports, null); + String typing = getPydanticType(param, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, null); List fields = new ArrayList<>(); String firstField = ""; @@ -1003,9 +1011,18 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements // update typing import for operation return type if (!StringUtils.isEmpty(operation.returnType)) { String typing = getPydanticType(operation.returnProperty, typingImports, - new TreeSet<>() /* skip pydantic import for return type */, datetimeImports, modelImports, null); + new TreeSet<>() /* skip pydantic import for return type */, datetimeImports, modelImports, exampleImports, null); } + // add import for code samples + // import models one by one + if (!exampleImports.isEmpty()) { + List imports = new ArrayList<>(); + for (String exampleImport : exampleImports) { + imports.add("from " + packageName + ".models." + underscore(exampleImport) + " import " + exampleImport); + } + operation.vendorExtensions.put("x-py-example-import", imports); + } } List> newImports = new ArrayList<>(); @@ -1040,21 +1057,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements } } - /* TODO - // need models import - if (hasModelsToImport) { - Map item = new HashMap<>(); - item.put("import", String.format(Locale.ROOT, "from %s import models", packageName)); - newImports.add(item); - } - - // models import - if (hasModelsToImport) { - Map item = new HashMap<>(); - item.put("import", String.format(Locale.ROOT, "from %s import %s", modelPackage, StringUtils.join(modelImports, ", "))); - newImports.add(item); - }*/ - // reset imports with newImports objs.setImports(newImports); return objs; @@ -1185,6 +1187,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements TreeSet modelImports = new TreeSet<>(); for (ModelMap m : objs.getModels()) { + TreeSet exampleImports = new TreeSet<>(); List readOnlyFields = new ArrayList<>(); hasModelsToImport = false; int property_count = 1; @@ -1229,7 +1232,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements //loop through properties/schemas to set up typing, pydantic for (CodegenProperty cp : codegenProperties) { - String typing = getPydanticType(cp, typingImports, pydanticImports, datetimeImports, modelImports, model.classname); + String typing = getPydanticType(cp, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, model.classname); List fields = new ArrayList<>(); String firstField = ""; diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/__init__package.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/__init__package.mustache index f598fc38c28..0729fd87a5a 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/__init__package.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/__init__package.mustache @@ -18,6 +18,10 @@ from {{packageName}}.exceptions import ApiValueError from {{packageName}}.exceptions import ApiKeyError from {{packageName}}.exceptions import ApiAttributeError from {{packageName}}.exceptions import ApiException +{{#hasHttpSignatureMethods}} +from {{packageName}}.signing import HttpSigningConfiguration +{{/hasHttpSignatureMethods}} + # import models into sdk package {{#models}} {{#model}} diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/api_doc.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/api_doc.mustache index a9bc6e09bf1..4a1d3648013 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/api_doc.mustache @@ -35,12 +35,10 @@ Method | HTTP request | Description {{#isOAuth}} * OAuth Authentication ({{name}}): {{/isOAuth }} -{{> api_doc_example }} {{/authMethods}} {{/hasAuthMethods}} -{{^hasAuthMethods}} {{> api_doc_example }} -{{/hasAuthMethods}} + ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/api_doc_example.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/api_doc_example.mustache index d8b29f7bd6c..d71d8436509 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/api_doc_example.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/api_doc_example.mustache @@ -1,10 +1,13 @@ ```python -from __future__ import print_function import time import os 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: diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/python_doc_auth_partial.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/python_doc_auth_partial.mustache index ba0382371eb..f478fe0f1ad 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/python_doc_auth_partial.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/python_doc_auth_partial.mustache @@ -64,9 +64,12 @@ configuration = {{{packageName}}}.Configuration( # the API server. # # See {{{packageName}}}.signing for a list of all supported parameters. +from {{{packageName}}} import signing +import datetime + configuration = {{{packageName}}}.Configuration( host = "{{{basePath}}}", - signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( + signing_info = {{{packageName}}}.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', diff --git a/samples/client/echo_api/python-nextgen/docs/BodyApi.md b/samples/client/echo_api/python-nextgen/docs/BodyApi.md index f0ba44f9747..99df044148d 100644 --- a/samples/client/echo_api/python-nextgen/docs/BodyApi.md +++ b/samples/client/echo_api/python-nextgen/docs/BodyApi.md @@ -19,12 +19,12 @@ Test binary (gif) response body ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -46,6 +46,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling BodyApi->test_binary_gif: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -79,12 +80,13 @@ Test body parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -107,6 +109,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling BodyApi->test_echo_body_pet: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -143,12 +146,13 @@ Test empty response body ### Example ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -171,6 +175,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling BodyApi->test_echo_body_pet_response_string: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/client/echo_api/python-nextgen/docs/FormApi.md b/samples/client/echo_api/python-nextgen/docs/FormApi.md index 197ec6aaa72..eab4a7bce45 100644 --- a/samples/client/echo_api/python-nextgen/docs/FormApi.md +++ b/samples/client/echo_api/python-nextgen/docs/FormApi.md @@ -17,12 +17,12 @@ Test form parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -47,6 +47,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling FormApi->test_form_integer_boolean_string: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/client/echo_api/python-nextgen/docs/HeaderApi.md b/samples/client/echo_api/python-nextgen/docs/HeaderApi.md index e0acb3b8f27..f24090ec21d 100644 --- a/samples/client/echo_api/python-nextgen/docs/HeaderApi.md +++ b/samples/client/echo_api/python-nextgen/docs/HeaderApi.md @@ -17,12 +17,12 @@ Test header parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -47,6 +47,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling HeaderApi->test_header_integer_boolean_string: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/client/echo_api/python-nextgen/docs/PathApi.md b/samples/client/echo_api/python-nextgen/docs/PathApi.md index 6f7f596f4b8..2c15c4f5612 100644 --- a/samples/client/echo_api/python-nextgen/docs/PathApi.md +++ b/samples/client/echo_api/python-nextgen/docs/PathApi.md @@ -17,12 +17,12 @@ Test path parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -46,6 +46,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/client/echo_api/python-nextgen/docs/QueryApi.md b/samples/client/echo_api/python-nextgen/docs/QueryApi.md index d4cf0386372..7acc99998b2 100644 --- a/samples/client/echo_api/python-nextgen/docs/QueryApi.md +++ b/samples/client/echo_api/python-nextgen/docs/QueryApi.md @@ -23,12 +23,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -53,6 +53,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_datetime_date_string: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -91,12 +92,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -121,6 +122,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_integer_boolean_string: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -159,12 +161,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -187,6 +189,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_style_deep_object_explode_true_object: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -223,12 +226,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -251,6 +254,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_style_deep_object_explode_true_object_all_of: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -287,12 +291,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -315,6 +319,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_style_form_explode_true_array_string: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -351,12 +356,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -379,6 +384,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_style_form_explode_true_object: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -415,12 +421,12 @@ Test query parameter(s) ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://localhost:3000 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -443,6 +449,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling QueryApi->test_query_style_form_explode_true_object_all_of: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/client/echo_api/python-nextgen/openapi_client/__init__.py b/samples/client/echo_api/python-nextgen/openapi_client/__init__.py index 56a61164ed2..8b0d7b1923e 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/__init__.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/__init__.py @@ -33,6 +33,7 @@ from openapi_client.exceptions import ApiValueError from openapi_client.exceptions import ApiKeyError from openapi_client.exceptions import ApiAttributeError from openapi_client.exceptions import ApiException + # import models into sdk package from openapi_client.models.bird import Bird from openapi_client.models.category import Category diff --git a/samples/client/echo_api/python-nextgen/test/test_manual.py b/samples/client/echo_api/python-nextgen/test/test_manual.py index 506f6dc7ecd..c32a382752d 100644 --- a/samples/client/echo_api/python-nextgen/test/test_manual.py +++ b/samples/client/echo_api/python-nextgen/test/test_manual.py @@ -31,6 +31,7 @@ class TestManual(unittest.TestCase): def testDateTimeQueryWithDateTimeFormat(self): api_instance = openapi_client.QueryApi() + datetime_format_backup = api_instance.api_client.configuration.datetime_format # backup dateime_format api_instance.api_client.configuration.datetime_format = "%Y-%m-%d %a %H:%M:%S%Z" datetime_query = datetime.datetime.fromisoformat('2013-10-20T19:20:30-05:00') # datetime | (optional) date_query = '2013-10-20' # date | (optional) @@ -41,6 +42,9 @@ class TestManual(unittest.TestCase): e = EchoServerResponseParser(api_response) self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20%20Sun%2019%3A20%3A30UTC-05%3A00&date_query=2013-10-20&string_query=string_query_example") + # restore datetime format + api_instance.api_client.configuration.datetime_format = datetime_format_backup + def testDateTimeQueryWithDateTime(self): api_instance = openapi_client.QueryApi() datetime_query = datetime.datetime.fromisoformat('2013-10-20T19:20:30-05:00') # datetime | (optional) diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/AnotherFakeApi.md index fc7fc266d50..8c3c78b95ff 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/AnotherFakeApi.md @@ -17,12 +17,13 @@ To test special tags and operation ID starting with number ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.client import Client from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -45,6 +46,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/DefaultApi.md index 826ebf49a1a..661c446ebf0 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/DefaultApi.md @@ -15,12 +15,13 @@ Method | HTTP request | Description ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -41,6 +42,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling DefaultApi->foo_get: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeApi.md index 6c225b2426f..755da50fe23 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeApi.md @@ -32,12 +32,12 @@ test any type request body ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -58,6 +58,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_any_type_request_body: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -92,12 +93,13 @@ Health check endpoint ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -119,6 +121,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_health_get: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -150,12 +153,13 @@ test http signature authentication ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -203,9 +207,12 @@ configuration = petstore_api.Configuration( # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -242,6 +249,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_http_signature_test: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -280,12 +288,12 @@ Test serialization of outer boolean types ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -307,6 +315,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -343,12 +352,13 @@ Test serialization of object with outer number type ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.outer_composite import OuterComposite from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -370,6 +380,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -406,12 +417,12 @@ Test serialization of outer number types ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -433,6 +444,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -469,12 +481,12 @@ Test serialization of outer string types ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -496,6 +508,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -532,12 +545,13 @@ Test serialization of enum (int) properties with examples ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -559,6 +573,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_property_enum_integer_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -595,12 +610,12 @@ For this test, the body has to be a binary file. ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -620,6 +635,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_body_with_binary: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -656,12 +672,13 @@ For this test, the body for this request must reference a schema named `File`. ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -681,6 +698,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -715,12 +733,13 @@ No authorization required ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -741,6 +760,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -778,12 +798,13 @@ To test \"client\" model ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.client import Client from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -806,6 +827,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_client_model: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -840,12 +862,12 @@ No authorization required ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -866,6 +888,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_date_time_query_parameter: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -904,12 +927,12 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン * Basic Authentication (http_basic_test): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -953,6 +976,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1004,12 +1028,12 @@ Fake endpoint to test group parameters (optional) * Bearer (JWT) Authentication (bearer_test): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1044,6 +1068,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_group_parameters: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1085,12 +1110,12 @@ test inline additionalProperties ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1111,6 +1136,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1147,12 +1173,12 @@ test json serialization of form data ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1174,6 +1200,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_json_form_data: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1211,12 +1238,12 @@ To test the collection format in query parameters ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1242,6 +1269,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeClassnameTags123Api.md index 180bad514ec..5ae7aaa0b40 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/FakeClassnameTags123Api.md @@ -18,12 +18,13 @@ To test class name in snake case * Api Key Authentication (api_key_query): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.client import Client from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -56,6 +57,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md index c63c0c6ec48..a0b92ad45c1 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md @@ -26,12 +26,13 @@ Add a new pet to the store * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -81,9 +82,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -118,98 +122,6 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->add_pet: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # 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: - # Add a new pet to the store - await api_instance.add_pet(pet) - except Exception as e: - print("Exception when calling PetApi->add_pet: %s\n" % e) -``` ### Parameters @@ -249,12 +161,12 @@ Deletes a pet * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -282,6 +194,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->delete_pet: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -321,12 +234,13 @@ Multiple status values can be provided with comma separated strings * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -376,9 +290,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -415,100 +332,6 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # 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: - # Finds Pets by status - api_response = await api_instance.find_pets_by_status(status) - print("The response of PetApi->find_pets_by_status:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) -``` ### Parameters @@ -548,12 +371,13 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -603,9 +427,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -642,100 +469,6 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - tags = ['tags_example'] # List[str] | Tags to filter by - - try: - # Finds Pets by tags - api_response = await api_instance.find_pets_by_tags(tags) - print("The response of PetApi->find_pets_by_tags:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) -``` ### Parameters @@ -775,12 +508,13 @@ Returns a single pet * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -813,6 +547,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->get_pet_by_id: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -852,12 +587,13 @@ Update an existing pet * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -907,9 +643,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -944,98 +683,6 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->update_pet: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # 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: - # Update an existing pet - await api_instance.update_pet(pet) - except Exception as e: - print("Exception when calling PetApi->update_pet: %s\n" % e) -``` ### Parameters @@ -1077,12 +724,12 @@ Updates a pet in the store with form data * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1111,6 +758,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->update_pet_with_form: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1151,12 +799,13 @@ uploads an image * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.api_response import ApiResponse from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1187,6 +836,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->upload_file: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1226,12 +876,13 @@ uploads an image (required) * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.api_response import ApiResponse from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1262,6 +913,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/StoreApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/StoreApi.md index 44f6b7e07c0..ce5b2660369 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/StoreApi.md @@ -20,12 +20,12 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -46,6 +46,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->delete_order: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -84,12 +85,12 @@ Returns a map of status codes to quantities * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -121,6 +122,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->get_inventory: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -154,12 +156,13 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.order import Order from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -182,6 +185,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->get_order_by_id: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -220,12 +224,13 @@ Place an order for a pet ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.order import Order from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -248,6 +253,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->place_order: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/UserApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/UserApi.md index caf35cc14c7..e33dcbe11b9 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/UserApi.md @@ -24,12 +24,13 @@ This can only be done by the logged in user. ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -50,6 +51,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -86,12 +88,13 @@ Creates list of users with given input array ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -112,6 +115,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -148,12 +152,13 @@ Creates list of users with given input array ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -174,6 +179,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -210,12 +216,12 @@ This can only be done by the logged in user. ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -236,6 +242,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->delete_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -273,12 +280,13 @@ Get user by user name ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -301,6 +309,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->get_user_by_name: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -339,12 +348,12 @@ Logs user into the system ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -368,6 +377,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->login_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -406,12 +416,12 @@ Logs out current logged in user session ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -431,6 +441,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->logout_user: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -464,12 +475,13 @@ This can only be done by the logged in user. ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -491,6 +503,7 @@ async with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->update_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/__init__.py index ef57b5c6e93..9cb9cf59ad8 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/__init__.py @@ -34,6 +34,8 @@ from petstore_api.exceptions import ApiValueError from petstore_api.exceptions import ApiKeyError from petstore_api.exceptions import ApiAttributeError from petstore_api.exceptions import ApiException +from petstore_api.signing import HttpSigningConfiguration + # import models into sdk package from petstore_api.models.additional_properties_class import AdditionalPropertiesClass from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/AnotherFakeApi.md index 9691c105ac6..273ee215490 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/AnotherFakeApi.md @@ -17,12 +17,13 @@ To test special tags and operation ID starting with number ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.client import Client from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -45,6 +46,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/DefaultApi.md index c7ebf52f727..24212469e33 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/DefaultApi.md @@ -15,12 +15,13 @@ Method | HTTP request | Description ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -41,6 +42,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling DefaultApi->foo_get: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/FakeApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/FakeApi.md index fc6167ff8b9..d268cedeeec 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/FakeApi.md @@ -32,12 +32,12 @@ test any type request body ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -58,6 +58,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_any_type_request_body: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -92,12 +93,13 @@ Health check endpoint ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -119,6 +121,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_health_get: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -150,12 +153,13 @@ test http signature authentication ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -203,9 +207,12 @@ configuration = petstore_api.Configuration( # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -242,6 +249,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_http_signature_test: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -280,12 +288,12 @@ Test serialization of outer boolean types ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -307,6 +315,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -343,12 +352,13 @@ Test serialization of object with outer number type ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.outer_composite import OuterComposite from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -370,6 +380,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -406,12 +417,12 @@ Test serialization of outer number types ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -433,6 +444,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -469,12 +481,12 @@ Test serialization of outer string types ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -496,6 +508,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -532,12 +545,13 @@ Test serialization of enum (int) properties with examples ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -559,6 +573,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->fake_property_enum_integer_serialize: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -595,12 +610,12 @@ For this test, the body has to be a binary file. ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -620,6 +635,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_body_with_binary: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -656,12 +672,13 @@ For this test, the body for this request must reference a schema named `File`. ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -681,6 +698,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -715,12 +733,13 @@ No authorization required ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -741,6 +760,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -778,12 +798,13 @@ To test \"client\" model ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.client import Client from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -806,6 +827,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_client_model: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -840,12 +862,12 @@ No authorization required ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -866,6 +888,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_date_time_query_parameter: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -904,12 +927,12 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン * Basic Authentication (http_basic_test): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -953,6 +976,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1004,12 +1028,12 @@ Fake endpoint to test group parameters (optional) * Bearer (JWT) Authentication (bearer_test): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1044,6 +1068,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_group_parameters: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1085,12 +1110,12 @@ test inline additionalProperties ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1111,6 +1136,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1147,12 +1173,12 @@ test json serialization of form data ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1174,6 +1200,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_json_form_data: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1211,12 +1238,12 @@ To test the collection format in query parameters ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1242,6 +1269,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-nextgen/docs/FakeClassnameTags123Api.md index 0c428b8ac26..aa0487d44d0 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/FakeClassnameTags123Api.md @@ -18,12 +18,13 @@ To test class name in snake case * Api Key Authentication (api_key_query): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.client import Client from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -56,6 +57,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md index 0321e8336bc..224c555dab1 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md @@ -26,12 +26,13 @@ Add a new pet to the store * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -81,9 +82,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -118,98 +122,6 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->add_pet: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Add a new pet to the store - api_instance.add_pet(pet) - except Exception as e: - print("Exception when calling PetApi->add_pet: %s\n" % e) -``` ### Parameters @@ -249,12 +161,12 @@ Deletes a pet * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -282,6 +194,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->delete_pet: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -321,12 +234,13 @@ Multiple status values can be provided with comma separated strings * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -376,9 +290,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -415,100 +332,6 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - status = ['status_example'] # List[str] | Status values that need to be considered for filter - - try: - # Finds Pets by status - api_response = api_instance.find_pets_by_status(status) - print("The response of PetApi->find_pets_by_status:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) -``` ### Parameters @@ -548,12 +371,13 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -603,9 +427,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -642,100 +469,6 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - tags = ['tags_example'] # List[str] | Tags to filter by - - try: - # Finds Pets by tags - api_response = api_instance.find_pets_by_tags(tags) - print("The response of PetApi->find_pets_by_tags:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) -``` ### Parameters @@ -775,12 +508,13 @@ Returns a single pet * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -813,6 +547,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->get_pet_by_id: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -852,12 +587,13 @@ Update an existing pet * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.pet import Pet from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -907,9 +643,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"] # the API server. # # See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( + signing_info = petstore_api.HttpSigningConfiguration( key_id = 'my-key-id', private_key_path = 'private_key.pem', private_key_passphrase = 'YOUR_PASSPHRASE', @@ -944,98 +683,6 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->update_pet: %s\n" % e) ``` -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Update an existing pet - api_instance.update_pet(pet) - except Exception as e: - print("Exception when calling PetApi->update_pet: %s\n" % e) -``` ### Parameters @@ -1077,12 +724,12 @@ Updates a pet in the store with form data * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1111,6 +758,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->update_pet_with_form: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1151,12 +799,13 @@ uploads an image * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.api_response import ApiResponse from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1187,6 +836,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->upload_file: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -1226,12 +876,13 @@ uploads an image (required) * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.api_response import ApiResponse from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -1262,6 +913,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/StoreApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/StoreApi.md index 65b1d85fa0c..0b99ab7f26d 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/StoreApi.md @@ -20,12 +20,12 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -46,6 +46,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->delete_order: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -84,12 +85,12 @@ Returns a map of status codes to quantities * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -121,6 +122,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->get_inventory: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -154,12 +156,13 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.order import Order from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -182,6 +185,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->get_order_by_id: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -220,12 +224,13 @@ Place an order for a pet ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.order import Order from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -248,6 +253,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->place_order: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/UserApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/UserApi.md index c7a40e8499d..c75e6ec4962 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/UserApi.md @@ -24,12 +24,13 @@ This can only be done by the logged in user. ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -50,6 +51,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -86,12 +88,13 @@ Creates list of users with given input array ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -112,6 +115,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -148,12 +152,13 @@ Creates list of users with given input array ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -174,6 +179,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -210,12 +216,12 @@ This can only be done by the logged in user. ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -236,6 +242,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->delete_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -273,12 +280,13 @@ Get user by user name ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -301,6 +309,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->get_user_by_name: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -339,12 +348,12 @@ Logs user into the system ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -368,6 +377,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->login_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -406,12 +416,12 @@ Logs out current logged in user session ### Example ```python -from __future__ import print_function import time import os import petstore_api from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -431,6 +441,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->logout_user: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -464,12 +475,13 @@ This can only be done by the logged in user. ### Example ```python -from __future__ import print_function import time import os import petstore_api +from petstore_api.models.user import User from petstore_api.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -491,6 +503,7 @@ with petstore_api.ApiClient(configuration) as api_client: print("Exception when calling UserApi->update_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/__init__.py index ef57b5c6e93..9cb9cf59ad8 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/__init__.py @@ -34,6 +34,8 @@ from petstore_api.exceptions import ApiValueError from petstore_api.exceptions import ApiKeyError from petstore_api.exceptions import ApiAttributeError from petstore_api.exceptions import ApiException +from petstore_api.signing import HttpSigningConfiguration + # import models into sdk package from petstore_api.models.additional_properties_class import AdditionalPropertiesClass from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef