- req = get(self._url, params=payload,
- timeout=SOCKET_TIMEOUT)
- #self.__class__.ratelimit = req.headers.get('x-ratelimit-remaining', None)
- if req.status_code is not 200:
- raise WSHTTPError('{0.status_code}: {0.reason}'.format(req))
- self.current_element = req.json()
- self._controls_answer()
- if self.caching:
- SimaFM.cache.update({req.url:
- Cache(self.current_element)})
-
- def _controls_answer(self):
+ sess = Session()
+ resp = sess.send(prepreq, timeout=SOCKET_TIMEOUT)
+ #self.__class__.ratelimit = resp.headers.get('x-ratelimit-remaining', None)
+ if resp.status_code is not 200:
+ raise WSHTTPError('{0.status_code}: {0.reason}'.format(resp))
+ ans = resp.json()
+ self._controls_answer(ans)
+ if self.cache:
+ self.controller.cache_response(resp.request, resp)
+ return ans
+
+ def _controls_answer(self, ans):