Package Bio :: Package WWW
[hide private]
[frames] | no frames]

Source Code for Package Bio.WWW

 1  # This code is part of the Biopython distribution and governed by its 
 2  # license.  Please see the LICENSE file that should have been included 
 3  # as part of this package. 
 4  """Deal with various biological databases and services on the web (DEPRECATED). 
 5   
 6  The functionality within Bio.WWW and its sub modules was deprecated in 
 7  Biopython 1.45, however most individual functions simply been moved: 
 8   
 9  Bio.WWW.ExPASy -> Bio.ExPASy 
10  Bio.WWW.InterPro -> Bio.InterPro 
11  Bio.WWW.NCBI -> Bio.Entrez 
12  Bio.WWW.SCOP -> Bio.SCOP 
13  """ 
14  import time 
15  import warnings 
16  warnings.warn("Bio.WWW was deprecated.  Most of its functionality is now "\ 
17                +"available from Bio.ExPASy, Bio.InterPro, Bio.Entrez and "\ 
18                +"Bio.SCOP.", DeprecationWarning) 
19   
20 -class RequestLimiter:
21 # This class implements a simple countdown timer for delaying WWW 22 # requests.
23 - def __init__(self, delay):
24 self.last_time = 0.0 25 self.delay = delay
26 - def wait(self, delay=None):
27 if delay is None: 28 delay = self.delay 29 how_long = self.last_time + delay - time.time() 30 if how_long > 0: 31 time.sleep(how_long) 32 self.last_time = time.time()
33