Created
September 5, 2022 22:09
-
-
Save lordjabez/43c632c7bb9ca92c9d83d8368f9fb0ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# pip3 install bitlyshortener pypng pyqrcode | |
import os | |
import sys | |
import bitlyshortener | |
import pyqrcode | |
long_urls = sys.argv[1:] | |
access_token = os.environ['BITLY_ACCESS_TOKEN'] | |
shortener = bitlyshortener.Shortener(tokens=[access_token]) | |
short_urls = shortener.shorten_urls(long_urls) | |
print(short_urls) | |
for short_url in short_urls: | |
name = short_url.split('/')[-1] | |
qr_code = pyqrcode.create(short_url) | |
qr_code.png(f'{name}.png', scale=10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment