diff --git a/clients/python/test/test_locales_api.py b/clients/python/test/test_locales_api.py index d6371c8b8..a898e8048 100644 --- a/clients/python/test/test_locales_api.py +++ b/clients/python/test/test_locales_api.py @@ -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 @@ -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) diff --git a/clients/python/test/test_uploads_api.py b/clients/python/test/test_uploads_api.py index 8eb11627f..6b0678cd9 100644 --- a/clients/python/test/test_uploads_api.py +++ b/clients/python/test/test_uploads_api.py @@ -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: diff --git a/openapi-generator/templates/python/README_onlypackage.mustache b/openapi-generator/templates/python/README_onlypackage.mustache index 149360d07..18b198d93 100644 --- a/openapi-generator/templates/python/README_onlypackage.mustache +++ b/openapi-generator/templates/python/README_onlypackage.mustache @@ -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 diff --git a/openapi-generator/templates/python/api_client.mustache b/openapi-generator/templates/python/api_client.mustache index 89eab7fa8..f5394e88f 100644 --- a/openapi-generator/templates/python/api_client.mustache +++ b/openapi-generator/templates/python/api_client.mustache @@ -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): diff --git a/openapi-generator/templates/python/exceptions.mustache b/openapi-generator/templates/python/exceptions.mustache index dd012f34a..5e1d808c3 100644 --- a/openapi-generator/templates/python/exceptions.mustache +++ b/openapi-generator/templates/python/exceptions.mustache @@ -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 diff --git a/openapi-generator/templates/python/python-experimental/README_onlypackage.mustache b/openapi-generator/templates/python/python-experimental/README_onlypackage.mustache index 37aa1eb83..11c002c9a 100644 --- a/openapi-generator/templates/python/python-experimental/README_onlypackage.mustache +++ b/openapi-generator/templates/python/python-experimental/README_onlypackage.mustache @@ -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 diff --git a/openapi-generator/templates/python/python-experimental/api_client.mustache b/openapi-generator/templates/python/python-experimental/api_client.mustache index 774dae89c..9a47a50fa 100644 --- a/openapi-generator/templates/python/python-experimental/api_client.mustache +++ b/openapi-generator/templates/python/python-experimental/api_client.mustache @@ -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): diff --git a/openapi-generator/templates/python/python-experimental/requirements.mustache b/openapi-generator/templates/python/python-experimental/requirements.mustache index 3b219f8ce..a56bedffb 100644 --- a/openapi-generator/templates/python/python-experimental/requirements.mustache +++ b/openapi-generator/templates/python/python-experimental/requirements.mustache @@ -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 diff --git a/openapi-generator/templates/python/python-experimental/setup.mustache b/openapi-generator/templates/python/python-experimental/setup.mustache index d6b586867..c1df4717e 100644 --- a/openapi-generator/templates/python/python-experimental/setup.mustache +++ b/openapi-generator/templates/python/python-experimental/setup.mustache @@ -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", diff --git a/openapi-generator/templates/python/requirements.mustache b/openapi-generator/templates/python/requirements.mustache index 86611d576..eb358efd5 100644 --- a/openapi-generator/templates/python/requirements.mustache +++ b/openapi-generator/templates/python/requirements.mustache @@ -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 diff --git a/openapi-generator/templates/python/rest.mustache b/openapi-generator/templates/python/rest.mustache index 418d8f268..51795af63 100644 --- a/openapi-generator/templates/python/rest.mustache +++ b/openapi-generator/templates/python/rest.mustache @@ -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.""" diff --git a/openapi-generator/templates/python/setup.mustache b/openapi-generator/templates/python/setup.mustache index 9fc8bec83..ce774eafb 100644 --- a/openapi-generator/templates/python/setup.mustache +++ b/openapi-generator/templates/python/setup.mustache @@ -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}}