Beispiel #1
0
 def execute(self, render=True):
     rendered = RenderManagers().render(self)
     if render:
         return rendered
     else:
         connection.setup(['localhost:9160:demodb'])
         connection.execute(rendered)
         print ("Hello")
Beispiel #2
0
 def execute(self, render=True):
     rendered = RenderQuery().render(self)
     if render:
         return rendered
     else:
         connection.setup(["localhost:9160:demodb"])
         query = connection.execute(rendered)
         print ("Executed Successfully")
         return query
Beispiel #3
0
        prompt = " [Y/n] "
    elif default == "no":
        prompt = " [y/N] "
    else:
        raise ValueError("invalid default answer: '%s'" % default)

    while True:
        sys.stdout.write(question + prompt)
        choice = raw_input().lower()
        if default is not None and choice == '':
            return valid[default]
        elif choice in valid:
            return valid[choice]
        else:
            sys.stdout.write(
                "Please respond with 'yes' or 'no' (or 'y' or 'n').\n")


if __name__ == '__main__':

    args = parse_args()
    from connection import setup, connect

    connect(*setup(args.hosts, args.keyspace))
    from hierachy import *

    if query_yes_no('Are you sure to sync ?', default='no'):
        create(args.keyspace)
        print "Done...."
    else:
        print "No is also a good thing. Bye!"
Beispiel #4
0
        prompt = " [Y/n] "
    elif default == "no":
        prompt = " [y/N] "
    else:
        raise ValueError("invalid default answer: '%s'" % default)

    while True:
        sys.stdout.write(question + prompt)
        choice = raw_input().lower()
        if default is not None and choice == '':
            return valid[default]
        elif choice in valid:
            return valid[choice]
        else:
            sys.stdout.write("Please respond with 'yes' or 'no' (or 'y' or 'n').\n")

# Usage example

if __name__ == '__main__':

    args = parse_args()
    from connection import setup, connect

    connect(*setup(args.hosts, args.keyspace))
    from hierachy import *

    if query_yes_no('Are you sure to sync ?', default='no'):
        create(args.keyspace)
        print "Done...."
    else:
        print "No is also a good thing. Bye!"
    })

    res = urequests.post(
        'http://192.168.9.102:8080/api/devices/receiveDeviceData',
        headers={
            'content-type': 'application/json'
        },
        data=post_data).json()


if machine.reset_cause() == machine.DEEPSLEEP_RESET:
    logger.log('Awaking from deepsleep...')
    logger.log('Reason for wake: ' +
               ('touch' if machine.wake_reason() ==
                5 else 'RTC' if machine.wake_reason() == 4 else 'unknown'))
    connection.setup()
else:
    logger.log('Starting up for the first time...')
    connection.setup()
    setTime()

t = machine.TouchPad(machine.Pin(13))
t.config(500)
esp32.wake_on_touch(True)

logTemp()

for i in range(5, 0, -1):
    print('Entering deepsleep in ' + str(i))
    time.sleep(1)