Skip to content

Commit 32c591d

Browse files
authored
Support multiple api keys in python example documentation (#7417)
* Support multiple api keys in config option * Regenerate samples * Update rest of examples
1 parent be40dbe commit 32c591d

File tree

21 files changed

+54
-162
lines changed

21 files changed

+54
-162
lines changed

modules/openapi-generator/src/main/resources/python/python_doc_auth_partial.mustache

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,8 @@ configuration = {{{packageName}}}.Configuration(
9292
{{#isApiKey}}
9393

9494
# Configure API key authorization: {{{name}}}
95-
configuration = {{{packageName}}}.Configuration(
96-
host = "{{{basePath}}}",
97-
api_key = {
98-
'{{name}}': 'YOUR_API_KEY'
99-
}
100-
)
95+
configuration.api_key['{{{name}}}'] = 'YOUR_API_KEY'
96+
10197
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
10298
# configuration.api_key_prefix['{{name}}'] = 'Bearer'
10399
{{/isApiKey}}

samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ configuration = petstore_api.Configuration(
3535
# satisfies your auth use case.
3636

3737
# Configure API key authorization: api_key_query
38-
configuration = petstore_api.Configuration(
39-
host = "http://petstore.swagger.io:80/v2",
40-
api_key = {
41-
'api_key_query': 'YOUR_API_KEY'
42-
}
43-
)
38+
configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
39+
4440
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
4541
# configuration.api_key_prefix['api_key_query'] = 'Bearer'
4642

samples/client/petstore/python-asyncio/docs/PetApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,8 @@ configuration = petstore_api.Configuration(
335335
# satisfies your auth use case.
336336

337337
# Configure API key authorization: api_key
338-
configuration = petstore_api.Configuration(
339-
host = "http://petstore.swagger.io:80/v2",
340-
api_key = {
341-
'api_key': 'YOUR_API_KEY'
342-
}
343-
)
338+
configuration.api_key['api_key'] = 'YOUR_API_KEY'
339+
344340
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
345341
# configuration.api_key_prefix['api_key'] = 'Bearer'
346342

samples/client/petstore/python-asyncio/docs/StoreApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,8 @@ configuration = petstore_api.Configuration(
100100
# satisfies your auth use case.
101101

102102
# Configure API key authorization: api_key
103-
configuration = petstore_api.Configuration(
104-
host = "http://petstore.swagger.io:80/v2",
105-
api_key = {
106-
'api_key': 'YOUR_API_KEY'
107-
}
108-
)
103+
configuration.api_key['api_key'] = 'YOUR_API_KEY'
104+
109105
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
110106
# configuration.api_key_prefix['api_key'] = 'Bearer'
111107

samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ configuration = petstore_api.Configuration(
3535
# satisfies your auth use case.
3636

3737
# Configure API key authorization: api_key_query
38-
configuration = petstore_api.Configuration(
39-
host = "http://petstore.swagger.io:80/v2",
40-
api_key = {
41-
'api_key_query': 'YOUR_API_KEY'
42-
}
43-
)
38+
configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
39+
4440
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
4541
# configuration.api_key_prefix['api_key_query'] = 'Bearer'
4642

samples/client/petstore/python-experimental/docs/PetApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,8 @@ configuration = petstore_api.Configuration(
368368
# satisfies your auth use case.
369369

370370
# Configure API key authorization: api_key
371-
configuration = petstore_api.Configuration(
372-
host = "http://petstore.swagger.io:80/v2",
373-
api_key = {
374-
'api_key': 'YOUR_API_KEY'
375-
}
376-
)
371+
configuration.api_key['api_key'] = 'YOUR_API_KEY'
372+
377373
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
378374
# configuration.api_key_prefix['api_key'] = 'Bearer'
379375

samples/client/petstore/python-experimental/docs/StoreApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,8 @@ configuration = petstore_api.Configuration(
9999
# satisfies your auth use case.
100100

101101
# Configure API key authorization: api_key
102-
configuration = petstore_api.Configuration(
103-
host = "http://petstore.swagger.io:80/v2",
104-
api_key = {
105-
'api_key': 'YOUR_API_KEY'
106-
}
107-
)
102+
configuration.api_key['api_key'] = 'YOUR_API_KEY'
103+
108104
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
109105
# configuration.api_key_prefix['api_key'] = 'Bearer'
110106

samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ configuration = petstore_api.Configuration(
3535
# satisfies your auth use case.
3636

3737
# Configure API key authorization: api_key_query
38-
configuration = petstore_api.Configuration(
39-
host = "http://petstore.swagger.io:80/v2",
40-
api_key = {
41-
'api_key_query': 'YOUR_API_KEY'
42-
}
43-
)
38+
configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
39+
4440
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
4541
# configuration.api_key_prefix['api_key_query'] = 'Bearer'
4642

samples/client/petstore/python-tornado/docs/PetApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,8 @@ configuration = petstore_api.Configuration(
335335
# satisfies your auth use case.
336336

337337
# Configure API key authorization: api_key
338-
configuration = petstore_api.Configuration(
339-
host = "http://petstore.swagger.io:80/v2",
340-
api_key = {
341-
'api_key': 'YOUR_API_KEY'
342-
}
343-
)
338+
configuration.api_key['api_key'] = 'YOUR_API_KEY'
339+
344340
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
345341
# configuration.api_key_prefix['api_key'] = 'Bearer'
346342

samples/client/petstore/python-tornado/docs/StoreApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,8 @@ configuration = petstore_api.Configuration(
100100
# satisfies your auth use case.
101101

102102
# Configure API key authorization: api_key
103-
configuration = petstore_api.Configuration(
104-
host = "http://petstore.swagger.io:80/v2",
105-
api_key = {
106-
'api_key': 'YOUR_API_KEY'
107-
}
108-
)
103+
configuration.api_key['api_key'] = 'YOUR_API_KEY'
104+
109105
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
110106
# configuration.api_key_prefix['api_key'] = 'Bearer'
111107

0 commit comments

Comments
 (0)