Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qure

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qure

A Python package to generate Student Cards with unique Qrcode from CSV or JSON

  • 0.3
  • PyPI
  • Socket score

Maintainers
1

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

  1. 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}")
  1. 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"}
    ]
}
  1. 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
  1. 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].

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc