forked from loafle/openapi-generator-original
[Python] add hasConsumes/hasProduces to Python API template (#4419)
* add hasConsumes/hasProduces to python api template * remove unused code in python * fix isFile in the api doc (python)
This commit is contained in:
@@ -196,17 +196,18 @@ class {{classname}}(object):
|
||||
if '{{paramName}}' in params:
|
||||
body_params = params['{{paramName}}']
|
||||
{{/bodyParam}}
|
||||
|
||||
{{#hasProduces}}
|
||||
# HTTP header `Accept`
|
||||
header_params['Accept'] = self.api_client.\
|
||||
select_header_accept([{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}])
|
||||
if not header_params['Accept']:
|
||||
del header_params['Accept']
|
||||
|
||||
{{/hasProduces}}
|
||||
{{#hasConsumes}}
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = self.api_client.\
|
||||
select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}])
|
||||
|
||||
{{/hasConsumes}}
|
||||
# Authentication setting
|
||||
auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user