Package biblio :: Package webquery :: Module querythrottle :: Class WaitNSecondsThrottle
[hide private]
[frames] | no frames]

Class WaitNSecondsThrottle

source code

   object --+        
            |        
 impl.ReprObj --+    
                |    
BaseQueryThrottle --+
                    |
                   WaitNSecondsThrottle
Known Subclasses:

Limit a query to every N seconds at most.

By default this throttle holds the query until the wait period is over. Note that this throttle can be used across a set of queries, so that the limit applies for the set. In this case the waiting behaviour could be undesirable, with a large population of queries on hold.

Instance Methods [hide private]
 
__init__(self, wait, fail_action='WAIT')
C'tor, allowing the wait period and failure behaviour to be set.
source code
 
within_limit(self, wquery)
Has it been longer than the wait period since the last query?
source code
 
log_success(self, wquery)
Sucessful queries will probably effect the success of future ones, so here is a place to log them.
source code

Inherited from BaseQueryThrottle: check_limit

Inherited from impl.ReprObj: __repr__, __str__, __unicode__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables [hide private]

Inherited from BaseQueryThrottle (private): _repr_fields

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, wait, fail_action='WAIT')
(Constructor)

source code 
C'tor, allowing the wait period and failure behaviour to be set.
Parameters:
  • wait (int or float) - The period to enforce between queries.
  • fail_action - See BaseQueryThrottle.
Overrides: object.__init__

within_limit(self, wquery)

source code 
Has it been longer than the wait period since the last query?
Parameters:
Overrides: BaseQueryThrottle.within_limit

log_success(self, wquery)

source code 
Sucessful queries will probably effect the success of future ones, so here is a place to log them.
Overrides: BaseQueryThrottle.log_success
(inherited documentation)