def get_config(): def read_config(): with open('configuration.csv', 'r') as f: settings = next(f) return [float(item) for item in settings.split(',')] try: return read_config() except FileNotFoundError: config() return read_config()
def get(self, *args, **kwargs): conf = configure.config() conf.runTest() if conf.configExist and conf.databaseConnect : raise tornado.web.HTTPError(403) else: self.render('configure/changeConf.html',error=False)
def post(self, *args, **kwargs): conf = configure.config() conf.runTest() if conf.configExist and conf.databaseConnect : # if configure successfully just return false raise tornado.web.HTTPError(403) else: pass databaseType = self.get_argument('databaseType') databaseUser = self.get_argument('databaseUser') databasePassword = self.get_argument('databasePassword') databaseHost = self.get_argument('databaseHost') databaseName = self.get_argument('databaseName') databaseDriver = self.get_argument('databaseDriver') flag = configure.config.checkDatabaseConnect(databaseType,databaseDriver,databaseUser,databasePassword,databaseHost,databaseName) if flag: # it can used! conf.saveConfFiles(databaseType,databaseDriver,databaseUser,databasePassword,databaseHost,databaseName) # finished... self.render('configure/result.html',) else: self.render('configure/changeConf.html',error=True)
# -*- coding: utf-8 -*- import shutil import glob import hashlib import datetime import sqlite3_adaptor import configure __author__ = 'HyunYoung' table = 'hash' sqlite = sqlite3_adaptor.SqliteAdaptor('data.db') config = configure.config() ''' Filename: main.py Created: Kim Hyunyoung Description : main file of this program Change history: 2015-09-18 / Created ''' def runMenu(): menu = { '1': updateDatabase, '2': moveDuplicatedFiles, '3': configure, '4': quit }
# -*- coding: utf-8 -*- """ Created on Tue Nov 13 21:00:52 2018 @author: Dragon """ import subprocess import RPi.GPIO as GPIO import time import configure #should install AWS CLI : pip3 install awscli --upgrade --user import picamera # should install picamera : sudo apt-get install python-picamera camera = picamera.PiCamera() #camera object camera.capture("input_image.jpg") configure.config() #configure the aws cli settings. GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(11, GPIO.IN) #Read output from PIR motion sensor i=0 while i!=1: print("checking") i=GPIO.input(11) if i==1: #When output from motion sensor is HIGH print("enter")
__version__ = '0.1.8.6' from configure import config config()