def Touch(request): print "\n[INFO] Sending Touch Events" try: data = {} if (request.method == 'POST') and (is_number( request.POST['x'])) and (is_number(request.POST['y'])): x_axis = request.POST['x'] y_axis = request.POST['y'] TOOLSDIR = os.path.join(settings.BASE_DIR, 'DynamicAnalyzer/tools/') #TOOLS DIR adb = getADB(TOOLSDIR) args = [ adb, "-s", getIdentifier(), "shell", "input", "tap", x_axis, y_axis ] data = {'status': 'success'} try: subprocess.call(args) except: data = {'status': 'error'} PrintException("[ERROR] Performing Touch Action") else: data = {'status': 'failed'} return HttpResponse(json.dumps(data), content_type='application/json') except: PrintException("[ERROR] Sending Touch Events") return HttpResponseRedirect('/error/')
def touch(request): """Sending Touch Events""" print("\n[INFO] Sending Touch Events") try: data = {} if (request.method == 'POST') and (is_number(request.POST['x'])) and (is_number(request.POST['y'])): x_axis = request.POST['x'] y_axis = request.POST['y'] adb = getADB() args = ["input", "tap", x_axis, y_axis] data = {'status': 'success'} try: adb_command(args, True) except: data = {'status': 'error'} PrintException("[ERROR] Performing Touch Action") else: data = {'status': 'failed'} return HttpResponse(json.dumps(data), content_type='application/json') except: PrintException("[ERROR] Sending Touch Events") return HttpResponseRedirect('/error/')
def touch(request): """Sending Touch Events.""" logger.info('Sending Touch Events') try: data = {} if (request.method == 'POST' and is_number(request.POST['x']) and is_number(request.POST['y'])): x_axis = request.POST['x'] y_axis = request.POST['y'] args = ['input', 'tap', x_axis, y_axis] data = {'status': 'success'} try: adb_command(args, True) except Exception: data = {'status': 'error'} logger.exception('Performing Touch Action') else: data = {'status': 'failed'} return HttpResponse(json.dumps(data), content_type='application/json') except Exception: logger.exception('Sending Touch Events') return print_n_send_error_response(request, 'Error Sending Touch Events', True)
def touch(request): """Sending Touch Events""" logger.info("Sending Touch Events") try: data = {} if (request.method == 'POST') and (is_number(request.POST['x'])) and (is_number(request.POST['y'])): x_axis = request.POST['x'] y_axis = request.POST['y'] adb = getADB() args = ["input", "tap", x_axis, y_axis] data = {'status': 'success'} try: adb_command(args, True) except: data = {'status': 'error'} PrintException("Performing Touch Action") else: data = {'status': 'failed'} return HttpResponse(json.dumps(data), content_type='application/json') except: PrintException("Sending Touch Events") return print_n_send_error_response(request, "Error Sending Touch Events", True)
def touch(request): """Sending Touch Events.""" data = {} try: env = Environment() x_axis = request.POST['x'] y_axis = request.POST['y'] if not is_number(x_axis) and not is_number(y_axis): logger.error('Axis parameters must be numbers') return invalid_params() args = ['input', 'tap', x_axis, y_axis] trd = threading.Thread(target=env.adb_command, args=(args, True)) trd.daemon = True trd.start() data = {'status': 'ok'} except Exception as exp: logger.exception('Sending Touch Events') data = {'status': 'failed', 'message': str(exp)} return json_response(data)
def Touch(request): print "\n[INFO] Sending Touch Events" try: data = {} if (request.method == "POST") and (is_number(request.POST["x"])) and (is_number(request.POST["y"])): x_axis = request.POST["x"] y_axis = request.POST["y"] TOOLSDIR = os.path.join(settings.BASE_DIR, "DynamicAnalyzer/tools/") # TOOLS DIR adb = getADB(TOOLSDIR) args = [adb, "-s", getIdentifier(), "shell", "input", "tap", x_axis, y_axis] data = {"status": "success"} try: subprocess.call(args) except: data = {"status": "error"} PrintException("[ERROR] Performing Touch Action") else: data = {"status": "failed"} return HttpResponse(json.dumps(data), content_type="application/json") except: PrintException("[ERROR] Sending Touch Events") return HttpResponseRedirect("/error/")
def Touch(request): print "\n[INFO] Sending Touch Events" try: data = {} if (request.method == 'POST') and (is_number(request.POST['x'])) and (is_number(request.POST['y'])): x_axis=request.POST['x'] y_axis=request.POST['y'] TOOLSDIR=os.path.join(settings.BASE_DIR, 'DynamicAnalyzer/tools/') #TOOLS DIR adb=getADB(TOOLSDIR) args=[adb, "-s", getIdentifier(), "shell","input","tap",x_axis,y_axis] data = {'status': 'success'} try: subprocess.call(args) except: data = {'status': 'error'} PrintException("[ERROR] Performing Touch Action") else: data = {'status': 'failed'} return HttpResponse(json.dumps(data), content_type='application/json') except: PrintException("[ERROR] Sending Touch Events") return HttpResponseRedirect('/error/')
def touch(request): """Sending Touch Events""" logger.info("Sending Touch Events") try: data = {} if (request.method == 'POST') and (is_number( request.POST['x'])) and (is_number(request.POST['y'])): x_axis = request.POST['x'] y_axis = request.POST['y'] adb = getADB() args = ["input", "tap", x_axis, y_axis] data = {'status': 'success'} try: adb_command(args, True) except: data = {'status': 'error'} PrintException("Performing Touch Action") else: data = {'status': 'failed'} return HttpResponse(json.dumps(data), content_type='application/json') except: PrintException("Sending Touch Events") return print_n_send_error_response(request, "Error Sending Touch Events", True)