def search_with_retry(self, sleeptime=3.0, retrycount=3, **params):
        """Perform a search given a dictionary of ``search(...)`` parameters.

        It accounts for server timeouts as necessary and will retry some number
        of times.

        :param sleeptime: number of seconds to sleep between retries
        :param retrycount: number of times to retry given search
        :param params: search parameters
        :return: records in given format
        """
        results = []
        count = 0
        while count < retrycount:
            try:
                results = self.search(**params)
                break
            except requests.exceptions.Timeout:
                sys.stderr.write("Timeout while searching...Retrying\n")
                time.sleep(sleeptime)
                count += 1
        else:
            sys.stderr.write(
                "Aborting search after %d attempts.\n" % (retrycount,))
        return results
def search_with_retry ( self , sleeptime = 3.0 , retrycount = 3 , ** params ) : results = [ ] count = 0 while count < retrycount : try : results = self . search ( ** params ) break except requests . exceptions . Timeout : sys . stderr . write ( "Timeout while searching...Retrying\n" ) time . sleep ( sleeptime ) count += 1 else : sys . stderr . write ( "Aborting search after %d attempts.\n" % ( retrycount , ) ) return results
Perform a search given a dictionary of ``search(...)`` parameters.

        It accounts for server timeouts as necessary and will retry some number
        of times.

        :param sleeptime: number of seconds to sleep between retries
        :param retrycount: number of times to retry given search
        :param params: search parameters
        :return: records in given format