def connect(self):
        #config = {}
        execfile("config.conf.new", config)

        self.conn = mysql.connector.connect(user='******', password='', host='localhost', database='nextdoor')
        self.conn.autocommit = True
        self.cursor = self.conn.cursor()
示例#2
0
    # longitude = float(input(bcolors.OKGreen + 'Longitude(WGS-84): ' + bcolors.RESET))
    # max_range = float(input(bcolors.OKGreen + 'Radius(km): ' + bcolors.RESET))
    # num_results = int(input(bcolors.OKGreen + 'Number of results: ' + bcolors.RESET))

    # TEST Case 1
    print(bcolors.OKGreen + 'Testing.... Location Boulder' + bcolors.RESET)
    latitude = float(40.0160921)
    longitude = float(-105.2812196)
    max_range = float(1)
    num_results = 50

    outfile = "output.csv"
    known_id = "IDLog.csv"

    config = {}
    execfile("conf.txt", config)

    twitter = Twitter.Api(
        auth=OAuth(config["access_key"], config["access_secret"],
                   config["consumer_key"], config["consumer_secret"]))

    file_exists1 = os.path.isfile("output.csv")
    file_exists2 = os.path.isfile("IDLog.csv")

    csvfile = open(outfile, 'a')
    csvwriter = csv.writer(csvfile)
    idfile = open(known_id, "a")
    idwriter = csv.writer(idfile)

    if (file_exists1 is not True):
        row = [
示例#3
0
def helloCallBack():
    execfile('main.py')
示例#4
0
def reset():
    """Reset local debug env."""
    activate_this = "env/bin/activate_this.py"
    from cffi.setuptools_ext import execfile
    execfile(activate_this, dict(__file__=activate_this))
    local("which python3")
        #self.conn.set_character_set('utf8')

    def query(self, sql, args=None):
        try:
            cursor = self.conn.cursor()
            cursor.execute(sql, '')
        except (AttributeError, mysql.connector.Error):
            self.connect()
            cursor = self.conn.cursor()
            cursor.execute(sql, args)
        return cursor


if __name__ == '__main__':
    config = {}
    execfile("config.conf.new", config)
    app.secret_key = config['app_key']
    db = DB()
    notifications = None


# Routes
@app.route('/')
def index():

    message = None
    global notifications
    if notifications:
        message = notifications
        notifications = None
    if 'username' not in session:
示例#6
0
def get_version(version_file):
    glob = {}
    execfile(version_file, glob)
    return glob["__version__"]