Beispiel #1
0
def checkerror():
	global errorcount
	prev = lastwritten
	now = datetime.datetime.now()
	minDiff = (now-prev)
	if minDiff.seconds > MAX_DIFF_SECONDS:
		errorcount = errorcount + 1
		logging.info("-- Notification message sent.")
		notify.notify_message("No download hapenning from last "+str(minDiff.seconds/60.0)+" minutes. please check into the server. Last downloaded game was from date: "+str(startdate)+" at: "+str(lastwritten))		
		logging.warning("-- Error checking in "+str(ERROR_CHECK_INTERVAL)+" seconds.")
Beispiel #2
0
    def login(self):

        payload = {
                      'username': self.username,
                      'password': self.password
                  }

	while self.has_internet()==False:
		print('waiting for an internet connection...')
		time.sleep(30)

        print('Logging in as {}...'.format(self.username))

        self.session = requests.session()
        response = self.session.post(self.login_url, data=payload)

        if(response.text.find('You are logged in') < 0):
		notify_message("Moodle Monitor", "Unable to login. Please check your credentials.")
		os.system("python /usr/share/moodle-monitor/settings/main.py")
		sys.exit('ERROR: Unable to login')