while True timeout endtime datetime now if timeout break settimeout ti

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
while True:
timeout = endtime - datetime.now()
if timeout < 0:
break
s.settimeout(timeout.seconds + timeout.microseconds / 1000000)
try:
r = s.read()
if r == None:
# Wow, we did it!
update_repository(name)
return
name += r
except timeout:
break