Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clients/python/test/test_locales_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys

if sys.version_info[:2] <= (3, 7):
from mock import Mock, patch
from mock import Mock, patch
else:
from unittest.mock import Mock, patch

Expand Down Expand Up @@ -71,7 +71,7 @@ def test_locale_download(self, mock_get):
mock_get.return_value.data = body
mock_get.return_value.status = 200
mock_get.return_value.getencoding.return_value = 'utf-8'
mock_get.return_value.getheader.side_effect = { 'Content-Disposition': None }.get
mock_get.return_value.headers = { 'Content-Disposition': None }

with phrase_api.ApiClient(self.configuration) as api_client:
api_instance = phrase_api.api.locales_api.LocalesApi(api_client)
Expand Down
2 changes: 1 addition & 1 deletion clients/python/test/test_uploads_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_upload_create(self, mock_post):
mock_post.return_value.data = '{"id": "upload_id", "format": "csv"}'.encode()
mock_post.return_value.getencoding.return_value = 'utf-8'
mock_post.return_value.status = 201
mock_post.return_value.getheader.side_effect = { 'Content-Type': "application/json" }.get
mock_post.return_value.headers = { 'Content-Type': "application/json" }

project_id = "project_id_example"
with phrase_api.ApiClient(self.configuration) as api_client:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This python library package is generated without supporting files like setup.py

To be able to use it, you will need these dependencies in your own package that uses this library:

* urllib3 >= 1.15, < 2.6
* urllib3 >= 1.15
* six >= 1.10
* certifi
* python-dateutil
Expand Down
4 changes: 2 additions & 2 deletions openapi-generator/templates/python/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ class ApiClient(object):
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
response_data.headers)
{{/tornado}}
{{#tornado}}
if _return_http_data_only:
raise tornado.gen.Return(return_data)
else:
raise tornado.gen.Return((return_data, response_data.status,
response_data.getheaders()))
response_data.headers))
{{/tornado}}

def sanitize_for_serialization(self, obj):
Expand Down
2 changes: 1 addition & 1 deletion openapi-generator/templates/python/exceptions.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ApiException(OpenApiException):
self.status = http_resp.status
self.reason = http_resp.reason
self.body = http_resp.data
self.headers = http_resp.getheaders()
self.headers = http_resp.headers
else:
self.status = status
self.reason = reason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This python library package is generated without supporting files like setup.py

To be able to use it, you will need these dependencies in your own package that uses this library:

* urllib3 >= 1.15, < 2.6
* urllib3 >= 1.15
* six >= 1.10
* certifi
* python-dateutil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ class ApiClient(object):
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
response_data.headers)
{{/tornado}}
{{#tornado}}
if _return_http_data_only:
raise tornado.gen.Return(return_data)
else:
raise tornado.gen.Return((return_data, response_data.status,
response_data.getheaders()))
response_data.headers))
{{/tornado}}

def sanitize_for_serialization(self, obj):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ future; python_version<="2.7"
six >= 1.10
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.15.1, < 2.6
urllib3 >= 1.15.1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ VERSION = "{{packageVersion}}"
# http://pypi.python.org/pypi/setuptools

REQUIRES = [
"urllib3>=1.15,<2.6",
"urllib3>=1.15",
"six >= 1.10",
"certifi",
"python-dateutil",
Expand Down
2 changes: 1 addition & 1 deletion openapi-generator/templates/python/requirements.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ future; python_version<="2.7"
six >= 1.10
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.15.1, < 2.6
urllib3 >= 1.15.1
4 changes: 2 additions & 2 deletions openapi-generator/templates/python/rest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class RESTResponse(io.IOBase):

def getheaders(self):
"""Returns a dictionary of the response headers."""
return self.urllib3_response.getheaders()
return self.urllib3_response.headers

def getheader(self, name, default=None):
"""Returns a given response header."""
return self.urllib3_response.getheader(name, default)
return self.urllib3_response.headers.get(name, default)

def getencoding(self):
"""Returns charset encoding returned by the server."""
Expand Down
2 changes: 1 addition & 1 deletion openapi-generator/templates/python/setup.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VERSION = "{{packageVersion}}"
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["urllib3>=1.15,<2.6", "six >= 1.10", "certifi", "python-dateutil"]
REQUIRES = ["urllib3>=1.15", "six >= 1.10", "certifi", "python-dateutil"]
{{#asyncio}}
REQUIRES.append("aiohttp >= 3.0.0")
{{/asyncio}}
Expand Down
Loading