def get(self):
     link_open = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
     urllib2.install_opener( link_open )
     
     login_params = "data={\"username\":\"Spring\", \"password\":\"[email protected]\", \"mechanism\":\"plain\"}"
     login_result = link_open.open( config.base_url + config.login_url, login_params )
     login_data = login_result.read()
     logging.info("Receive data " + login_data)
     print login_data
     login_json = json.loads(login_data)
     login_result.close()
     self.response.headers['Content-Type'] = 'text/plain'
     #save sessionid for this connection
     sessionid = login_json["sessionid"]
     
     fetchor = Detector( 5, sessionid, login_json['deviceid'] )
     fetchor.start()
     fetchor.run()
     fetchor.join()
    def get(self):
        link_open = urllib2.build_opener(urllib2.HTTPCookieProcessor())
        urllib2.install_opener(link_open)

        login_params = "data={\"username\":\"Spring\", \"password\":\"[email protected]\", \"mechanism\":\"plain\"}"
        login_result = link_open.open(config.base_url + config.login_url,
                                      login_params)
        login_data = login_result.read()
        logging.info("Receive data " + login_data)
        print login_data
        login_json = json.loads(login_data)
        login_result.close()
        self.response.headers['Content-Type'] = 'text/plain'
        #save sessionid for this connection
        sessionid = login_json["sessionid"]

        fetchor = Detector(5, sessionid, login_json['deviceid'])
        fetchor.start()
        fetchor.run()
        fetchor.join()
Ejemplo n.º 3
0
    login_json = json.loads(login_data)
    login_result.close()

    #save sessionid for this connection
    sessionid = login_json["sessionid"]
    print sessionid

    '''
    # get devices
    device_params = "data={\"sessionid\":\"" + login_json["sessionid"] + "\"}"
    device_result = link_open.open( base_url + device_url, device_params );
    device_data = device_result.read()
    device_result.close()
    device_json = json.loads(device_data)
    '''

    # save deviceids
    boundbox = (100, 100, 150, 150)
    fetchor = Detector( 5, sessionid, content['deviceid'], boundbox )
    fetchor.start()
    fetchor.join()
    #fetchor.run()
    #threadone = myTimer(1,1)
    #threadtow = myTimer(2,3)
    #threadone.start()
    #threadtow.start()

    print 'OK'
finally:
    print 'Finished'
Ejemplo n.º 4
0
    print login_data
    login_json = json.loads(login_data)
    login_result.close()

    #save sessionid for this connection
    sessionid = login_json["sessionid"]
    print sessionid
    '''
    # get devices
    device_params = "data={\"sessionid\":\"" + login_json["sessionid"] + "\"}"
    device_result = link_open.open( base_url + device_url, device_params );
    device_data = device_result.read()
    device_result.close()
    device_json = json.loads(device_data)
    '''

    # save deviceids
    boundbox = (100, 100, 150, 150)
    fetchor = Detector(5, sessionid, content['deviceid'], boundbox)
    fetchor.start()
    fetchor.join()
    #fetchor.run()
    #threadone = myTimer(1,1)
    #threadtow = myTimer(2,3)
    #threadone.start()
    #threadtow.start()

    print 'OK'
finally:
    print 'Finished'