A Python package for generating QR codes and shortening URLs using open source services.
- Generate QR codes for any URL
- Shorten URLs using multiple open source services (TinyURL, is.gd, v.gd)
- Combine both: shorten URL and generate QR code in one step
- Command-line interface with ASCII QR display in terminal
- Save QR codes as PNG or SVG
- Interactive Jupyter notebook UI
- Hosted web app via Streamlit (no install needed)
- Simple, intuitive API
pip install qrurlsOr with uv (faster):
uv pip install qrurlsfrom qrurls import QRURLs
# Create instance
qrurls = QRURLs(service='tinyurl')
# Shorten URL and generate QR code
short_url, filepath = qrurls.process(
'https://www.example.com/very/long/url',
output_path='qr_code.png'
)
print(f"Shortened URL: {short_url}")
print(f"QR code saved to: {filepath}")# Shorten URL + generate QR code (prints ASCII QR to terminal + saves PNG)
qrurls https://example.com/some/long/url
# Shorten only — prints the short URL
qrurls https://example.com/some/long/url --shorten-only
# QR code only — no URL shortening
qrurls https://example.com --qr-only
# Choose a service and output file
qrurls https://example.com -s isgd -o my_qr.png
# Customise QR appearance
qrurls https://example.com --box-size 5 --border 2Try QRURLs directly in your browser — no Python required:
Or run it locally:
pip install qrurls[streamlit]
streamlit run streamlit_app.pyFor a user-friendly interface, use the included Jupyter notebook:
# Install with notebook support
pip install qrurls[notebook]
# Launch Jupyter
jupyter notebook qrurls_interactive.ipynbThe notebook provides:
- Interactive widgets for all options
- Live QR code preview
- Automatic file saving with timestamps
- Clickable shortened URLs
- Batch processing examples
from qrurls import URLShortener
shortener = URLShortener(service='isgd')
short_url = shortener.shorten('https://www.example.com/long/url')
print(short_url)from qrurls import QRGenerator
qr_gen = QRGenerator(box_size=10, border=4)
qr_gen.generate('https://example.com', output_path='qr.png')from qrurls import QRURLs
# Initialize with preferred service
qrurls = QRURLs(service='vgd', box_size=10, border=4)
# Shorten and create QR code
short_url, filepath = qrurls.process(
'https://www.example.com',
output_path='output_qr.png'
)
# Or use separately
short_url = qrurls.shorten_only('https://example.com')
filepath = qrurls.qr_only('https://example.com', 'qr.png')tinyurl- TinyURL (default)isgd- is.gdvgd- v.gd
- Python 3.9+
- qrcode[pil]
- requests
- Pillow
QR codes can encode more than just URLs — patient/specimen labels for labs, WiFi credentials, vCards, inventory tags, batch label generation from CSV, and more.
If you'd like to see any of these features, please star the repo and open an issue describing your use case!
If you use QRURLs in your research or project, please cite it:
@software{priyanka_o_qrurls,
author = {Priyanka O},
title = {QRURLs},
url = {https://github.com/priya-gitTest/qrurls},
license = {MIT}
}GitHub will also show a "Cite this repository" button on the sidebar (powered by the CITATION.cff file).
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.
# Clone and install in dev mode
git clone https://github.com/priya-gitTest/qrurls.git
cd qrurls
uv pip install -e ".[dev]"
# Run tests
pytest
# Lint and format
ruff check qrurls/ tests/
ruff format qrurls/ tests/
# Type check
mypy qrurls/