CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-qrcode

QR Code image generator with customizable image formats, error correction levels, and styling options

42%

Overall

Evaluation42%

0.86x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-6/

URL QR Code Generator

Create a utility that generates QR codes for URLs with customization options.

Objective

Build a Python function that takes a URL string and generates a QR code image file. The function should support error correction levels and color customization.

Requirements

Core Functionality

Implement a function generate_url_qrcode(url, output_path, **options) that:

  1. Accepts a URL string as input
  2. Generates a QR code encoding the URL
  3. Saves the QR code as a PNG image to the specified output path
  4. Supports optional parameters for error correction and colors

Configuration Options

The function should accept these optional parameters via **options:

  • error_correction: Error correction level
  • fill_color: Foreground color for QR modules (default: "black")
  • back_color: Background color (default: "white")

Default Behavior

When called with only url and output_path, the function should generate a basic QR code with default settings.

Implementation Notes

  • Use a simple, single-step approach to generate QR codes
  • Automatic version selection and encoding should be handled internally
  • The generated image must be directly saveable to the output path

Dependencies { .dependencies }

qrcode { .dependency }

Provides QR code generation functionality.

Test Cases

Test 1: Basic URL QR Code @test

Input:

  • URL: "https://example.com"
  • Output path: "test_qrcode.png"

Expected Behavior:

  • A PNG file test_qrcode.png is created
  • The file exists and is readable
  • The QR code encodes the URL "https://example.com"

Test file: test_qrcode_generator.py

Test 2: Custom Colors @test

Input:

  • URL: "https://github.com"
  • Output path: "colored_qrcode.png"
  • Options: fill_color="blue", back_color="yellow"

Expected Behavior:

  • A PNG file colored_qrcode.png is created with blue modules on a yellow background
  • The file exists and is readable

Test file: test_qrcode_generator.py

Test 3: High Error Correction @test

Input:

  • URL: "https://www.example.org/page"
  • Output path: "high_ec_qrcode.png"
  • Options: error_correction set to highest level

Expected Behavior:

  • A PNG file high_ec_qrcode.png is created with high error correction
  • The QR code should be scannable even with partial damage or obstruction

Test file: test_qrcode_generator.py

Install with Tessl CLI

npx tessl i tessl/pypi-qrcode@7.4.0
What are skills?

tile.json