Check also for maintenance in BaseCitizen._errors_in_response()

This commit is contained in:
Eriks K 2020-09-23 11:15:18 +03:00
parent 1d93864dca
commit 955432e0d2

View File

@ -624,8 +624,16 @@ class BaseCitizen(access_points.CitizenAPI):
self.sleep(5 * 60)
else:
raise classes.ErepublikException(f"HTTP {response.status_code} error!")
if re.search(r'Occasionally there are a couple of things which we need to check or to implement in order make '
r'your experience in eRepublik more pleasant. <strong>Don\'t worry about ongoing battles, timer '
r'will be stopped during maintenance.</strong>', response.text):
self.write_log("eRepublik ss having maintenance. Sleeping for 5 minutes")
self.sleep(5 * 60)
return True
return bool(re.search(r'body id="error"|Internal Server Error|'
r'CSRF attack detected|meta http-equiv="refresh"|not_authenticated', response.text))
r'CSRF attack detected|meta http-equiv="refresh"|'
r'not_authenticated', response.text))
def _report_action(self, action: str, msg: str, **kwargs: Optional[Dict[str, Any]]):
""" Report action to all available reporting channels