import qrcode # DOI of the article doi = "10.3390/s21014816" # URL of the article url = "https://ncbi.nlm.nih.gov/pmc/articles/PMC8309744/#sec4dot1-sensors-21-04816" # Combine DOI and URL for better accessibility doi_url = f"DOI: {doi}\n{url}" # Generate QR code qr = qrcode.QRCode( version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4, ) qr.add_data(doi_url) qr.make(fit=True) # Create an image from the QR Code instance img = qr.make_image(fill_color="black", back_color="white") # Save the QR code as an image file img.save("doi_qr_code.png")