
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Thanks to Melisa for her precious help.
⚠️ This python package is still in development. ⚠️
I used this package to learn how to use the fastapi package. The API that I created is available at https://qrgeneratorapi-1-c9139268.deta.app.
Use it to generate QR codes by sending GET requests to the API.
For now the API can return the QR code data or the QR code image encoded in base64.
Example usage:
import requests
from PIL import Image
import base64
url = 'https://qrgeneratorapi-1-c9139268.deta.app/qrimg/test'
#get json
r = requests.get(url)
jsonData = r.json() #Get the json answer from the API
size = jsonData["img"]["size"]
base64Data = jsonData["img"]["base64"]
imgdecoded = Image.frombytes('L', (size, size), base64.b64decode(base64Data)) #Decode the image
imgdecoded.show() #Show the image
pip install barcodes-uc
You might want to install the package in a virtual environment. For that do:
python3 -m venv venv
source venv/bin/activate
pip install barcodes-uc
from barcodes_uc.qrcodes import qrgenerator, qrutils
# Generate a QR code
message = "Hello world!"
encoding = qrutils.QREncoding.byte
version, error_correction_level, qr = qrgenerator.get_min_version(message, encoding, qrutils.QRErrorCorrectionLevels.Q)
generator = qrgenerator.QRGenerator(msg=message, encoding=encoding, version=version, error_correction=error_correction_level)
qr = generator.generate()
qr.show() # Show the QR code in the terminal
qr.save("qr.png", imgSize = 1000, colour=[qrgenerator.QRColour.red]) # Save the QR code in a file
The package comes with CLI tools:
qrcode --help
usage: qrcode [-h] [-e {byte,numeric,alphanumeric,kanji}] [-V QR_VERSION] [-E {L,M,Q,H}] [--save SAVE] [--no-show] message
Create QR codes
positional arguments:
message Message to encode
optional arguments:
-h, --help show this help message and exit
-e {byte,numeric,alphanumeric,kanji}, --encoding {byte,numeric,alphanumeric,kanji}
Encoding of the message
-V QR_VERSION, --qr-version QR_VERSION
QR version, 1-40
-E {L,M,Q,H}, --qr-error-correction {L,M,Q,H}
QR error correction
--save SAVE Save the QR code to a .png file, do not add the file format
--no-show Do not show the QR code
Made by Pedro Juan Royo, @UnstrayCato
The program will show the QR code in the terminal and save it to a file if the --save
option is used.
If no -e, -V or -E options are used, the program will try to guess the best options for the message.
Add byte and numeric encoding to qr codes.
Save qr code as image in different styles.
Generate barcodes.
FAQs
A library to generate barcodes
We found that barcodes-uc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.