Changeset 6886
- Timestamp:
- Apr 23, 2009, 3:25:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/system_tools.py
r6860 r6886 341 341 # @param auth Auth tuple (httpproxy, proxyuser, proxypass). 342 342 # @param blocksize Read file in this block size. 343 # @return 'auth' tuple for subsequent calls, if successful, else False.343 # @return (True, auth) if successful, else (False, auth). 344 344 # @note If 'auth' not supplied, will prompt user. 345 345 # @note Will try using environment variable HTTP_PROXY for proxy server. … … 365 365 try: 366 366 urllib.urlretrieve(file_url, file_name) 367 return None# no proxy, no auth required367 return (True, auth) # no proxy, no auth required 368 368 except IOError, e: 369 369 if e[1] == 407: # proxy error … … 371 371 elif e[1][0] == 113: # no route to host 372 372 print 'No route to host for %s' % file_url 373 return False# return False373 return (False, auth) # return False 374 374 else: 375 375 print 'Unknown connection error to %s' % file_url 376 return False376 return (False, auth) 377 377 378 378 # We get here if there was a proxy error, get file through the proxy … … 423 423 try: 424 424 webget = urllib2.urlopen(file_url) 425 except urllib2.HTTPError: 426 return False 425 except urllib2.HTTPError, e: 426 print 'Error received from proxy:\n%s' % str(e) 427 print 'Possibly the user/password is wrong.' 428 return (False, auth) 427 429 428 430 # transfer file to local filesystem … … 437 439 438 440 # return successful auth info 439 return ( httpproxy, proxyuser, proxypass)441 return (True, (httpproxy, proxyuser, proxypass)) 440 442 441 443
Note: See TracChangeset
for help on using the changeset viewer.