Skip to content

Commit 3251f8c

Browse files
michazwing328
authored andcommitted
Adapt Python README template, fixes #7269 (#8069)
1 parent c660111 commit 3251f8c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

modules/swagger-codegen/src/main/resources/python/README.mustache

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,21 @@ from {{{packageName}}}.rest import ApiException
6060
from pprint import pprint
6161
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
6262
# Configure HTTP basic authorization: {{{name}}}
63-
{{{packageName}}}.configuration.username = 'YOUR_USERNAME'
64-
{{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
63+
configuration = {{{packageName}}}.Configuration()
64+
configuration.username = 'YOUR_USERNAME'
65+
configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
6566
# Configure API key authorization: {{{name}}}
66-
{{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
67+
configuration = {{{packageName}}}.Configuration()
68+
configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
6769
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
68-
# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
70+
# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
6971
# Configure OAuth2 access token for authorization: {{{name}}}
70-
{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
72+
configuration = {{{packageName}}}.Configuration()
73+
configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
7174
{{/hasAuthMethods}}
75+
7276
# create an instance of the API class
73-
api_instance = {{{packageName}}}.{{{classname}}}()
77+
api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration))
7478
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
7579
{{/allParams}}
7680

0 commit comments

Comments
 (0)