mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=2092
This commit is contained in:
parent
b7999ecf0a
commit
b80320d566
|
@ -10,14 +10,20 @@ import urllib, random
|
||||||
def read_url(url, quiet=False):
|
def read_url(url, quiet=False):
|
||||||
'''return 1 line from url'''
|
'''return 1 line from url'''
|
||||||
verbose_echo(2, " reading url: "+url)
|
verbose_echo(2, " reading url: "+url)
|
||||||
|
err = ''
|
||||||
try:
|
try:
|
||||||
return urllib.URLopener().open(url).readline().strip()
|
return urllib.URLopener().open(url).readline().strip()
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
if not quiet:
|
err = e
|
||||||
error("couldn't access url: %s %s" % (url, e))
|
except AttributeError:
|
||||||
else:
|
# Python urllib is buggy if connection is closed (by our proxy
|
||||||
verbose_echo(2, "couldn't access url: %s %s" % (url, e))
|
# intentionally) right after opened
|
||||||
return ''
|
pass
|
||||||
|
if not quiet:
|
||||||
|
error("couldn't access url: %s %s" % (url, err))
|
||||||
|
else:
|
||||||
|
verbose_echo(2, "couldn't access url: %s %s" % (url, err))
|
||||||
|
return ''
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_msg("framework sanity");
|
test_msg("framework sanity");
|
||||||
|
|
Loading…
Reference in New Issue