1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-26 20:47:10 +00:00

Android barcode scanner

This commit is contained in:
Alexandre Iooss 2019-08-11 12:05:05 +02:00
parent 77379e9059
commit d08ac181c9
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02

35
tool_barcode_getblue.py Normal file
View File

@ -0,0 +1,35 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
import os
"""
GetBlue Android parameters
Host: http://IP_DU_PC:8080
Parameter for data: data
Parameter for timestamp: timestamp
HTTP request: GET
"""
class Server(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
self._set_headers()
isbn = self.path[7:-24]
print("Hey j'ai un ISBN :", isbn)
os.system("xdotool type " + isbn)
os.system("xdotool key KP_Enter")
def do_HEAD(self):
self._set_headers()
if __name__ == "__main__":
server_address = ('', 8080)
httpd = HTTPServer(server_address, Server)
print('Starting httpd...')
httpd.serve_forever()