Skip to content

qrGenerator #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions System-Automation-Scripts/qrGenerator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# qrGenerator

- A Python Script that asks the user to input an URL or any string of characters and then coverts it to a QR code as the name of the URL domain, saved locally in the current working directory or as specified by the user.
- Also, if the program finds an existing QR with the same filename, it creates a new one with a random number at the end of the filename.
- Can be used either in the Command Line or within the Python IDE
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import random

if len(argv)==2:
url = str(argv[1])
url = str(argv[1])
else:
url = input("Enter an URL to Encode in QR: ")
url = input("Enter an URL to Encode in QR: ")

path = ((urlparse(url)).netloc)
image = qrcode.make(url)

if os.path.exists(f"{path}.png"):
path = path + str(random.randint(0,1000))
path = path + str(random.randint(0,10000))

image.save(f"{path}.png", "PNG")
file_path = os.path.abspath(path)
print("File saved to:", file_path)
print("File saved to:", file_path)