Skip to content

Commit 90e25f6

Browse files
authored
[BUG][Python] init access token for python client configuration (#7469)
* fix: init access token for python client configuration * fix: remove duplicate initializations for access_token
1 parent 4c3820f commit 90e25f6

5 files changed

Lines changed: 10 additions & 24 deletions

File tree

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ conf = {{{packageName}}}.Configuration(
163163

164164
def __init__(self, host=None,
165165
api_key=None, api_key_prefix=None,
166+
access_token=None,
166167
username=None, password=None,
167168
discard_unknown_keys=False,
168169
disabled_client_side_validations="",
@@ -190,6 +191,7 @@ conf = {{{packageName}}}.Configuration(
190191
"""Temp file folder for downloading files
191192
"""
192193
# Authentication Settings
194+
self.access_token = access_token
193195
self.api_key = {}
194196
if api_key:
195197
self.api_key = api_key
@@ -218,18 +220,6 @@ conf = {{{packageName}}}.Configuration(
218220
"""The HTTP signing configuration
219221
"""
220222
{{/hasHttpSignatureMethods}}
221-
{{#hasOAuthMethods}}
222-
self.access_token = None
223-
"""access token for OAuth/Bearer
224-
"""
225-
{{/hasOAuthMethods}}
226-
{{^hasOAuthMethods}}
227-
{{#hasBearerMethods}}
228-
self.access_token = None
229-
"""access token for OAuth/Bearer
230-
"""
231-
{{/hasBearerMethods}}
232-
{{/hasOAuthMethods}}
233223
self.logger = {}
234224
"""Logging Settings
235225
"""

samples/client/petstore/python-asyncio/petstore_api/configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class Configuration(object):
122122

123123
def __init__(self, host=None,
124124
api_key=None, api_key_prefix=None,
125+
access_token=None,
125126
username=None, password=None,
126127
discard_unknown_keys=False,
127128
disabled_client_side_validations="",
@@ -146,6 +147,7 @@ def __init__(self, host=None,
146147
"""Temp file folder for downloading files
147148
"""
148149
# Authentication Settings
150+
self.access_token = access_token
149151
self.api_key = {}
150152
if api_key:
151153
self.api_key = api_key
@@ -167,9 +169,6 @@ def __init__(self, host=None,
167169
"""
168170
self.discard_unknown_keys = discard_unknown_keys
169171
self.disabled_client_side_validations = disabled_client_side_validations
170-
self.access_token = None
171-
"""access token for OAuth/Bearer
172-
"""
173172
self.logger = {}
174173
"""Logging Settings
175174
"""

samples/client/petstore/python-tornado/petstore_api/configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class Configuration(object):
123123

124124
def __init__(self, host=None,
125125
api_key=None, api_key_prefix=None,
126+
access_token=None,
126127
username=None, password=None,
127128
discard_unknown_keys=False,
128129
disabled_client_side_validations="",
@@ -147,6 +148,7 @@ def __init__(self, host=None,
147148
"""Temp file folder for downloading files
148149
"""
149150
# Authentication Settings
151+
self.access_token = access_token
150152
self.api_key = {}
151153
if api_key:
152154
self.api_key = api_key
@@ -168,9 +170,6 @@ def __init__(self, host=None,
168170
"""
169171
self.discard_unknown_keys = discard_unknown_keys
170172
self.disabled_client_side_validations = disabled_client_side_validations
171-
self.access_token = None
172-
"""access token for OAuth/Bearer
173-
"""
174173
self.logger = {}
175174
"""Logging Settings
176175
"""

samples/client/petstore/python/petstore_api/configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class Configuration(object):
118118

119119
def __init__(self, host=None,
120120
api_key=None, api_key_prefix=None,
121+
access_token=None,
121122
username=None, password=None,
122123
discard_unknown_keys=False,
123124
disabled_client_side_validations="",
@@ -142,6 +143,7 @@ def __init__(self, host=None,
142143
"""Temp file folder for downloading files
143144
"""
144145
# Authentication Settings
146+
self.access_token = access_token
145147
self.api_key = {}
146148
if api_key:
147149
self.api_key = api_key
@@ -163,9 +165,6 @@ def __init__(self, host=None,
163165
"""
164166
self.discard_unknown_keys = discard_unknown_keys
165167
self.disabled_client_side_validations = disabled_client_side_validations
166-
self.access_token = None
167-
"""access token for OAuth/Bearer
168-
"""
169168
self.logger = {}
170169
"""Logging Settings
171170
"""

samples/openapi3/client/petstore/python/petstore_api/configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class Configuration(object):
159159

160160
def __init__(self, host=None,
161161
api_key=None, api_key_prefix=None,
162+
access_token=None,
162163
username=None, password=None,
163164
discard_unknown_keys=False,
164165
disabled_client_side_validations="",
@@ -184,6 +185,7 @@ def __init__(self, host=None,
184185
"""Temp file folder for downloading files
185186
"""
186187
# Authentication Settings
188+
self.access_token = access_token
187189
self.api_key = {}
188190
if api_key:
189191
self.api_key = api_key
@@ -210,9 +212,6 @@ def __init__(self, host=None,
210212
self.signing_info = signing_info
211213
"""The HTTP signing configuration
212214
"""
213-
self.access_token = None
214-
"""access token for OAuth/Bearer
215-
"""
216215
self.logger = {}
217216
"""Logging Settings
218217
"""

0 commit comments

Comments
 (0)