Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class ApiClient:
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -338,7 +338,7 @@ class ApiClient:
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -719,7 +719,7 @@ class ApiClient:
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ class RESTResponse(io.IOBase):
self.data = await self.response.read()
return self.data

@property
def headers(self):
"""Returns a CIMultiDictProxy of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a CIMultiDictProxy of the response headers."""
"""Returns a CIMultiDictProxy of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ApiException(OpenApiException):
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ class RESTResponse(io.IOBase):
self.data = await self.response.aread()
return self.data

@property
def headers(self):
"""Returns a CIMultiDictProxy of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a CIMultiDictProxy of the response headers."""
"""Returns a CIMultiDictProxy of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ class RESTResponse(io.IOBase):
self.data = self.response.data
return self.data

@property
def headers(self):
"""Returns a dictionary of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a dictionary of the response headers."""
"""Returns a dictionary of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ class RESTResponse(io.IOBase):
self.data = self.response.body
return self.data

@property
def headers(self):
"""Returns a CIMultiDictProxy of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a CIMultiDictProxy of the response headers."""
"""Returns a CIMultiDictProxy of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def response_deserialize(
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -330,7 +330,7 @@ def response_deserialize(
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -702,7 +702,7 @@ def __deserialize_file(self, response):
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ def read(self):
self.data = self.response.data
return self.data

@property
def headers(self):
"""Returns a dictionary of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a dictionary of the response headers."""
"""Returns a dictionary of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
6 changes: 3 additions & 3 deletions samples/client/echo_api/python/openapi_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def response_deserialize(
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -330,7 +330,7 @@ def response_deserialize(
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -702,7 +702,7 @@ def __deserialize_file(self, response):
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down
9 changes: 7 additions & 2 deletions samples/client/echo_api/python/openapi_client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ def read(self):
self.data = self.response.data
return self.data

@property
def headers(self):
"""Returns a dictionary of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a dictionary of the response headers."""
"""Returns a dictionary of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def response_deserialize(
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -332,7 +332,7 @@ def response_deserialize(
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -711,7 +711,7 @@ def __deserialize_file(self, response):
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ async def read(self):
self.data = await self.response.read()
return self.data

@property
def headers(self):
"""Returns a CIMultiDictProxy of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a CIMultiDictProxy of the response headers."""
"""Returns a CIMultiDictProxy of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def response_deserialize(
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -332,7 +332,7 @@ def response_deserialize(
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -711,7 +711,7 @@ def __deserialize_file(self, response):
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ async def read(self):
self.data = await self.response.aread()
return self.data

@property
def headers(self):
"""Returns a CIMultiDictProxy of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a CIMultiDictProxy of the response headers."""
"""Returns a CIMultiDictProxy of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def response_deserialize(
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -329,7 +329,7 @@ def response_deserialize(
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -708,7 +708,7 @@ def __deserialize_file(self, response):
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ def read(self):
self.data = self.response.data
return self.data

@property
def headers(self):
"""Returns a dictionary of response headers."""
return self.response.headers

def getheaders(self):
"""Returns a dictionary of the response headers."""
"""Returns a dictionary of the response headers; use ``headers`` instead."""
return self.response.headers

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


Expand Down
Loading
Loading