A Python package to generate Student Cards with unique Qrcode from CSV or JSON
Project description
Qure: QR Code Generator and Scanner Library
Overview
This library provides an easy-to-use API for generating and scanning QR codes and Student Cards with data encryption. The library can read JSON and CSV input files, allowing flexibility in the types of data processed. QR codes generated by this library are encrypted using the cryptography package, ensuring data security.
The library features:
Data Encryption: Encrypts data before encoding it into a QR code for added security. Flexible Data Input: Accepts data in JSON or CSV format. Automatic QR Code Generation: Generates QR codes from student information or other data sets. QR Code Scanning: Supports reading and decrypting encrypted data from QR codes. Prerequisites To use this library, ensure you have:
Python 3.6+ installed. The necessary dependencies listed in requirements.txt.
Installation
Clone the Repository
git clone https://github.com/fraterneelyh/qure.git
cd qure
Install Dependencies Install the required dependencies using requirements.txt:
pip install -r requirements.txt
Alternatively, you can install directly using:
pip install qrcode[pil] Pillow pyzbar cryptography
Folder Structure Ensure the qrcodes directory exists or is created at runtime if saving QR codes in this folder.
Usage
- Generate a Single QR Code with JSON Data To generate a QR code for a single record in JSON format:
from qure.generation.generator import QRGenerator
# Define data
data = {
"name": "Alice Johnson",
"age": 25,
"email": "alice@example.com",
"photo": "path/to/student_image"
}
# Create QRGenerator instance and generate QR code
qr_generator = QRGenerator(data)
file_path = qr_generator.generate()
print(f"QR code saved to: {file_path}")
- Generate Multiple QR Codes from a JSON File To generate multiple QR codes from a JSON file with a list of students:
from qure.generation.generator import generate_multiple_qrcodes
# Provide JSON file path
json_file_path = "path/to/your/students.json"
generate_multiple_qrcodes(json_file_path)
Example JSON Structure
{
"students": [
{"name": "Alice", "age": 22, "email": "alice@example.com", "photo": "path/to/student/photo"},
{"name": "Bob", "age": 23, "email": "bob@example.com", "photo": "path/to/student/photo"}
]
}
- Generate QR Codes from CSV Data This library also allows QR code generation from CSV data:
Copy code
from qure.generation.generator import generate_multiple_qrcodes_from_csv
csv_file_path = "path/to/your/students.csv"
generate_multiple_qrcodes_from_csv(csv_file_path)
Example CSV Structure
name,age,email
Alice,22,alice@example.com
Bob,23,bob@example.com
- Scanning and Decrypting QR Codes To scan and decrypt an encrypted QR code:
from qure.scanner.scanner import QRScanner
# Provide the path to the QR code image
qr_scanner = QRScanner("path/to/your/qrcode.png")
decrypted_data = qr_scanner.scan()
print("Decrypted data:", decrypted_data)
Configuration
Encryption Key: The library automatically uses a generated key for encryption and decryption. If you need to set a custom key, modify the key in qure/encryption.py.
Output Folder: Ensure the qrcodes folder exists for saving QR codes. Use the following code to create the folder if it doesn't exist:
Copy code
import os
os.makedirs("qrcodes", exist_ok=True)
Dependencies
i. qrcode[pil] - For creating QR codes.
ii. Pillow - For handling image file operations.
iii. pyzbar - For decoding QR codes.
iv. cryptography - For encrypting and decrypting data in QR codes.
These dependencies are listed in requirements.txt.
Testing
This library includes tests to verify its functionality. You can run tests with:
Copy code
python -m unittest discover tests
Contributing
Contributions are welcome! Please follow these steps:
Fork the repository and clone it locally.
Create a new branch for your feature or bugfix.
Make your changes and update tests if necessary.
Run tests to ensure no new issues are introduced.
Submit a pull request, describing your changes.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contact
For questions or further assistance, please reach out to HOZANA INEZA Fraterne Ely at [fraterneelyh@gmail.com].
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qure-0.3.tar.gz.
File metadata
- Download URL: qure-0.3.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c132732256cbcaf5c61b0dfdf00b8b300b772d72fb40b1561e524e1347930121
|
|
| MD5 |
2d15b91573392bffad9430c4b4db002d
|
|
| BLAKE2b-256 |
68c015382642dc39ef139cbe780e7a4a0563af3c290047a4132e6181ebc63b5f
|
File details
Details for the file qure-0.3-py3-none-any.whl.
File metadata
- Download URL: qure-0.3-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd4ca6b5185597618e28ff5ab5ff2fa4d3e9dbba92a8ca605d367b8aaf9ac5a6
|
|
| MD5 |
73e027cc152021ba400d214cec0b4033
|
|
| BLAKE2b-256 |
08e5cba39d7fbc819207d081e72a1203b826e289e245af688f244828f4a7ce11
|