|
18 | 18 |
|
19 | 19 | from pyodata.exceptions import HttpError, PyODataException, ExpressionError, ProgramError |
20 | 20 | from . import model |
21 | | -from .response import Response |
22 | 21 |
|
23 | 22 | LOGGER_NAME = 'pyodata.service' |
24 | 23 |
|
@@ -103,7 +102,8 @@ def decode(message): |
103 | 102 | class ODataHttpResponse: |
104 | 103 | """Representation of http response""" |
105 | 104 |
|
106 | | - def __init__(self, headers, status_code, content=None): |
| 105 | + def __init__(self, headers, status_code, content=None, url=None): |
| 106 | + self.url = url |
107 | 107 | self.headers = headers |
108 | 108 | self.status_code = status_code |
109 | 109 | self.content = content |
@@ -327,11 +327,10 @@ async def async_execute(self): |
327 | 327 | headers=headers, |
328 | 328 | params=params, |
329 | 329 | data=body) as async_response: |
330 | | - response = Response() |
331 | | - response.url = async_response.url |
332 | | - response.headers = async_response.headers |
333 | | - response.status_code = async_response.status |
334 | | - response.content = await async_response.read() |
| 330 | + response = ODataHttpResponse(url=async_response.url, |
| 331 | + headers=async_response.headers, |
| 332 | + status_code=async_response.status, |
| 333 | + content=await async_response.read()) |
335 | 334 | return self._call_handler(response) |
336 | 335 |
|
337 | 336 | def execute(self): |
@@ -889,7 +888,7 @@ def __getattr__(self, attr): |
889 | 888 | raise AttributeError('EntityType {0} does not have Property {1}: {2}' |
890 | 889 | .format(self._entity_type.name, attr, str(ex))) |
891 | 890 |
|
892 | | - async def getattr(self, attr): |
| 891 | + async def async_getattr(self, attr): |
893 | 892 | """Get cached value of attribute or do async call to service to recover attribute value""" |
894 | 893 | try: |
895 | 894 | return self._cache[attr] |
|
0 commit comments