Commit d08ac181 authored by erdnaxe's avatar erdnaxe 🎇

Android barcode scanner

parent 77379e90
Pipeline #1421 passed with stage
in 3 minutes and 27 seconds
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()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment