30 lines
910 B
Python
Executable File
30 lines
910 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import pyqrcode, os, sys
|
|
|
|
choix = input("(M)ail ou (U)rl ? ")
|
|
|
|
if choix == "M" or choix == "m":
|
|
qr_request = "mailto:" + input("Saisissez une adresse mail : ")
|
|
elif choix == "U" or choix == "u":
|
|
qr_request = "https://" + input("Complétez l'URL : https://")
|
|
else:
|
|
print("Paramètre incorrect !")
|
|
sys.exit()
|
|
|
|
qr_png = os.getcwd() + "/" + qr_request.replace("https://", "").replace("mailto:", "").replace("/", "_") + ".png"
|
|
try:
|
|
taille = int(input("Taille (1-100 par defaut=5) : ").strip() or "5")
|
|
if taille < 1 or taille > 100:
|
|
print("Valeur incorrecte !")
|
|
else:
|
|
qr = pyqrcode.create(qr_request)
|
|
qr.png(qr_png, scale=taille)
|
|
print("Sauvegardé dans " + qr_png)
|
|
|
|
except ValueError:
|
|
print("Valeur numérique uniquement !")
|
|
except PermissionError:
|
|
print("Données erronées !")
|
|
except FileNotFoundError:
|
|
print("Données erronées !") |