# import necessary modules# for implementing the HTTP Web serversimporthttp.server# provides access to the BSD socket interfaceimportsocket# a framework for network serversimportsocketserver# to display a Web-based documents to usersimportwebbrowser# to generate qrcodeimportpyqrcodefrompyqrcodeimportQRCode# convert into png formatimportpng# to access operating system controlimportos# assigning the appropriate port valuePORT=8010# this finds the name of the computer useros.environ['USERPROFILE']# changing the directory to access the files desktop# with the help of os moduledesktop=os.path.join(os.path.join(os.environ['USERPROFILE']),'OneDrive')os.chdir(desktop)# creating a http requestHandler=http.server.SimpleHTTPRequestHandler# returns, host name of the system under# which Python interpreter is executedhostname=socket.gethostname()# finding the IP address of the PCs=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)s.connect(("8.8.8.8",80))IP="http://"+s.getsockname()[0]+":"+str(PORT)link=IP# converting the IP address into the form of a QRcode# with the help of pyqrcode module# converts the IP address into a Qrcodeurl=pyqrcode.create(link)# saves the Qrcode inform of svgurl.svg("myqr.svg",scale=8)# opens the Qrcode image in the web browserwebbrowser.open('myqr.svg')# Creating the HTTP request and serving the# folder in the PORT 8010,and the pyqrcode is generated# continuous stream of data between client and serverwithsocketserver.TCPServer(("",PORT),Handler)ashttpd:print("serving at port",PORT)print("Type this in your Browser",IP)print("or Use the QRCode")httpd.serve_forever()