2
0
mirror of https://github.com/WikiTeam/wikiteam synced 2024-11-04 12:00:28 +00:00

retrying when server is slow

git-svn-id: https://wikiteam.googlecode.com/svn/trunk@22 31edc4fc-5e31-b4c4-d58b-c8bc928bcb95
This commit is contained in:
emijrp 2011-04-07 21:04:17 +00:00
parent 1e7c20cba7
commit 20f9231e7c

View File

@ -151,7 +151,17 @@ def getXMLPage(config={}, title=''):
params['limit'] = limit
data = urllib.urlencode(params)
req = urllib2.Request(url=config['domain'], data=data, headers=headers)
f = urllib2.urlopen(req)
try:
f = urllib2.urlopen(req)
except:
try:
print 'Sever is slow... Waiting some seconds and retrying...'
time.sleep(10)
f = urllib2.urlopen(req)
except:
print 'An error have occurred while retrieving', title
print 'Please, resume the dump, --resume'
sys.exit()
xml = f.read()
#if complete history, check if this page history has > limit edits, if so, retrieve all using offset if available