def contato(): if (request.method == 'POST'): mail(request) return render_template('contato.html', msg=1) else: return render_template('contato.html')
def open(self): if not self.error: try: self.sql = sqlalchemy.create_engine("mysql://%s:%s@%s/%s" % (self.user, self.passwd, self.host, self.dbname)).connect() self.db = sqlalchemy.Table('player_info', sqlalchemy.MetaData(self.sql), autoload=True) except Exception, error: console.error('Could not connect to DB: %s' % error) functions.mail('SQL ERRORS AHEAD', 'You\'ve received this email because\nMonitor failed to \ connect to the db.\n The error was:\n %s' % error) self.error = True threading.Thread(target=self.sql_watch).start()
message = "Osmolateur - niveau eau OK" if functions.instatetrois() is True: temps = functions.getconfig('temps_mini_pompe_osmolateur') sleep(int(temps)) functions.setcompletestate(path, 'state_2', 0, message, 0, 0) # remplissage en cours elif LEVEL_OK_STATE == '0': message = "Osmolateur - remplissage en cours" if functions.notinstatehuit() is True: functions.setcompletestate(path, 'state_3', 0, message, 0, 0) # osmolateur off else: message = "Osmolateur - off" functions.setcompletestate(path, 'state_5', 1, message, 1, 0) functions.setcontrole('controle_osmolateur') sys.exit() except Exception as e: message = "Osmolateur - ERREUR SCRIPT" body = "<p style='color:red;text-transform:uppercase;'>" + message + " - " + str(e) + "</p>" functions.setcompletestate(path, 'state_6', 1, message + " - " + str(e), 1, 0) functions.mail(message, body) functions.off_relay(relay) raise
elif value == 'remote': functions.remote_webserver() else: print("Please enter valid choice") if choice == 2: value = input("Where do you want to perform this task local/remote") if value == 'local': functions.local_docker() elif value == 'remote': functions.remote_docker() else: print("Please enter valid choice") if choice == 3: functions.mail() if choice == 4: functions.sms() if choice == 5: functions.yum() if choice == 6: functions.saas() if choice == 7: functions.privacy() else: print("invalid")