Merge pull request #20 from mohammed78620/master

updates csrf token when invalid
This commit is contained in:
Felix Lohmeier 2022-01-17 10:34:26 +01:00 committed by GitHub
commit 965c4e97fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -97,6 +97,11 @@ class RefineServer(object):
try: try:
response = urllib2.urlopen(req) response = urllib2.urlopen(req)
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
if 'Missing or invalid csrf_token parameter' == e.msg:
self.get_csrf_token()
params['csrf_token'] = self.token
response = urllib2.urlopen(req)
else:
raise Exception('HTTP %d "%s" for %s\n\t%s' % (e.code, e.msg, e.geturl(), data)) raise Exception('HTTP %d "%s" for %s\n\t%s' % (e.code, e.msg, e.geturl(), data))
except urllib2.URLError as e: except urllib2.URLError as e:
raise urllib2.URLError( raise urllib2.URLError(