reg_result = 0
while_timeout = time.time() + 120
while reg_result is not "REGISTERED" and time.time() < while_timeout:
reg_result = LeshanObj.validate_reg_time(parameter_1)
from polling import TimeoutException, poll
try:
poll(lambda: reg_result=='REGISTERED', timeout=120, step=1)
except TimeOutException as tee:
print "Value was not registered"
python轮询中有一个库(https://pypi.python.org/pypi/polling/0.3.0) 你可以用这个
希望有帮助。
相关问题 更多 >
编程相关推荐