Skip to content

Commit 9a64b3b

Browse files
committed
fix: add enum_values for httpx
1 parent a985607 commit 9a64b3b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
{{>partial_header}}
44

55

6+
{{#async}}
67
import base64
8+
{{/async}}
79
import copy
810
import http.client as httplib
911
import logging
@@ -621,9 +623,16 @@ conf = {{{packageName}}}.Configuration(
621623
if self.password is not None:
622624
password = self.password
623625

626+
{{#async}}
624627
return "Basic " + base64.b64encode(
625628
(username + ":" + password).encode('utf-8')
626629
).decode('utf-8')
630+
{{/async}}
631+
{{^async}}
632+
return urllib3.util.make_headers(
633+
basic_auth=username + ':' + password
634+
).get('authorization')
635+
{{/async}}
627636

628637
def auth_settings(self)-> AuthSettings:
629638
"""Gets Auth Settings dict for api client.
@@ -726,6 +735,11 @@ conf = {{{packageName}}}.Configuration(
726735
]
727736
{{/-last}}
728737
{{/enumValues}}
738+
{{^enumValues}}
739+
{{#async}}
740+
'enum_values': []
741+
{{/async}}
742+
{{/enumValues}}
729743
}{{^-last}},{{/-last}}
730744
{{#-last}}
731745
}
@@ -768,6 +782,7 @@ conf = {{{packageName}}}.Configuration(
768782
variable_name, variable['default_value'])
769783

770784
if 'enum_values' in variable \
785+
and variable['enum_values'] \
771786
and used_value not in variable['enum_values']:
772787
raise ValueError(
773788
"The variable `{0}` in the host URL has invalid value "

0 commit comments

Comments
 (0)