elementapi 0.9.1__tar.gz → 0.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elementapi
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: element-iot api client lib
5
5
  Home-page: https://github.com/ZennerIoT/python-elementapi
6
6
  Download-URL: https://github.com/ZennerIoT/python-elementapi/archive/master.zip
@@ -128,12 +128,14 @@ class ElementAPI:
128
128
  if not self._meta:
129
129
  resp=self._raw_req(('mandates', ))
130
130
 
131
- mandates = resp.json()
131
+
132
+ mandates = resp.json().get('body')
132
133
  parent = None
133
134
  is_multi = len(mandates)>1
134
135
 
135
136
  if is_multi:
136
137
  for m in mandates:
138
+ print(m)
137
139
  if not m.get('parent_id'):
138
140
  parent = m
139
141
  break
@@ -149,7 +151,7 @@ class ElementAPI:
149
151
  'mandate_id': mandate_id ,
150
152
  'mandate': mandate,
151
153
  'is_multi': is_multi,
152
- 'mandates': mandates.get('body'),
154
+ 'mandates': mandates,
153
155
  'version': resp.json().get('nodes',[{}])[0].get('version')
154
156
 
155
157
  }
@@ -197,10 +199,21 @@ class ElementAPI:
197
199
  )
198
200
  )
199
201
 
200
- def _raw_req(self, uri=None, limit=None, lib_filter=None, stream=False, raise_rl=False, noapi=False, **opts):
201
- return list(self._req(uri=uri, limit=limit, lib_filter=lib_filter, stream=stream, raise_rl=raise_rl, noapi=noapi, raw=True, **opts))[-1]
202
+ def _raw_req(self, uri=None, limit=None, noapi=False, **opts):
203
+ url = self.genurl(
204
+ (uri if uri else ()),
205
+ noapi=noapi,
206
+ limit=limit,
207
+ **opts
208
+ )
209
+ self._log_request("GET", url)
210
+ resp = requests.get(url, **self.requestargs)
211
+
212
+ return resp
202
213
 
203
- def _req(self, uri=None, limit=None, lib_filter=None, stream=False, raise_rl=False, raw=False, noapi=False, **opts):
214
+
215
+
216
+ def _req(self, uri=None, limit=None, lib_filter=None, stream=False, raise_rl=False, noapi=False, **opts):
204
217
  resp = None
205
218
  count = 0
206
219
 
@@ -216,9 +229,6 @@ class ElementAPI:
216
229
  self._log_request("GET (streaming)", url)
217
230
  resp = requests.get(url, **self.requestargs)
218
231
 
219
- if raw:
220
- yield resp
221
-
222
232
  if resp.status_code >= 400:
223
233
  raise ElementAPIException('HTTP Error', resp.status_code, get_body(resp))
224
234
 
@@ -249,9 +259,6 @@ class ElementAPI:
249
259
  last_response = resp
250
260
  resp = requests.get(url, **self.requestargs)
251
261
 
252
- if raw:
253
- yield resp
254
-
255
262
  if resp.status_code >= 400:
256
263
  if resp.status_code == 429 and not raise_rl:
257
264
  # hit create-limit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elementapi
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: element-iot api client lib
5
5
  Home-page: https://github.com/ZennerIoT/python-elementapi
6
6
  Download-URL: https://github.com/ZennerIoT/python-elementapi/archive/master.zip
@@ -3,7 +3,7 @@ from setuptools import setup
3
3
  setup(
4
4
  name='elementapi',
5
5
  packages=['elementapi'],
6
- version='0.9.1',
6
+ version='0.9.2',
7
7
  description='element-iot api client lib',
8
8
  author='Stefan Reiser',
9
9
  author_email='sr@zenner-iot.com',
File without changes