From: BenoƮt Fontaine Date: Fri, 8 Dec 2017 13:39:22 +0000 (+0100) Subject: Add warning for code 403 X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=7ba2d2bc12acb4b437ddc24e4a9276b67f27d4a0;p=gamesguru%2Fgetmyancestors.git Add warning for code 403 --- diff --git a/getmyancestors.py b/getmyancestors.py index 1be2187..0c80461 100755 --- a/getmyancestors.py +++ b/getmyancestors.py @@ -195,9 +195,13 @@ class Session: except requests.exceptions.HTTPError: if self.verbose: self.logfile.write('[' + time.strftime("%Y-%m-%d %H:%M:%S") + ']: HTTPError\n') - if r.status_code == 403 and 'message' in r.json()['errors'][0] and r.json()['errors'][0]['message'] == u'Unable to get ordinances.': - self.logfile.write('Unable to get ordinances. Try with an LDS account or without option -c.\n') - exit() + if r.status_code == 403: + if 'message' in r.json()['errors'][0] and r.json()['errors'][0]['message'] == u'Unable to get ordinances.': + self.logfile.write('Unable to get ordinances. Try with an LDS account or without option -c.\n') + exit() + else: + self.logfile.write('Warning code 403 link: ' + url + ' ' + r.json()['errors'][0]['message'] or '') + return None time.sleep(self.timeout) continue return r.json()