def _get_fresh_content(self, request): """ Retrieve a fresh copy of the resource from the source. :param request: the request object for which the response is needed. :return: the response to the request """ response = HttpAuthenticated.send(self, request) return response
def send(self, request): """ Send a request and return the response. If the minimum number of seconds between requests have not yet elapsed, then the function sleeps for the remaining period and then passes the request along. """ now = int(time.time()) logger.debug('Getting SOAP response') tsincelast = now - self._last_called if tsincelast < self._minumum_spacing: tleft = self._minumum_spacing - tsincelast logger.info("Throttling SOAP client for {0}".format(tleft)) time.sleep(tleft) self._last_called = now return HttpAuthenticated.send(self, request)