[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:
wing328
2016-12-18 17:20:10 +08:00
committed by GitHub
parent 7e67307bb4
commit 8ccf9828e4
8 changed files with 14 additions and 138 deletions

View File

@@ -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}}]