forked from aweber/AWeber-API-Python-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponse.py
More file actions
29 lines (23 loc) · 721 Bytes
/
response.py
File metadata and controls
29 lines (23 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from aweber_api import AWeberBase
class AWeberResponse(AWeberBase):
def __init__(self, url, data, adapter):
self._type = None
self.adapter = adapter
self.url = url
self._data = data
self._entries = {}
def _generate_type(self):
if 'resource_type_link' in self._data:
type = self._data['resource_type_link']
self._type = type.split('#').pop()
return None
@property
def type(self):
if not self._type:
self._generate_type()
return self._type
def __getattr__(self, attr):
if attr in self._data:
return self._data[attr]
else:
raise AttributeError(attr)