or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/cloudinary@1.44.x
tile.json

tessl/pypi-cloudinary

tessl install tessl/pypi-cloudinary@1.44.0

Python and Django SDK for Cloudinary, a cloud-based image and video management service with comprehensive transformation, optimization, and delivery capabilities

Agent Success

Agent success rate when using this tile

94%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.08x

Baseline

Agent success rate without this tile

87%

task.mdevals/scenario-3/

Image Gallery URL Routing System

Summary

Build a Python script that manages custom URL routing for a cloud-based image gallery. The system should allow administrators to configure how images in different folders are accessed through custom URL patterns.

Requirements

1. Mapping Management

Implement a script url_manager.py that provides the following functionality:

Create URL Mapping

  • Accept a folder name and a URL template as inputs
  • Configure the mapping so that images in the specified folder will be accessible through the custom URL pattern
  • Return confirmation that the mapping was created successfully

List All URL Mappings

  • Retrieve and display all currently configured URL mappings
  • Show both the folder name and the associated URL template for each mapping
  • Format the output as a readable list

Update URL Mapping

  • Accept a folder name and a new URL template
  • Update the existing mapping for that folder
  • Return confirmation of the update

Delete URL Mapping

  • Accept a folder name as input
  • Remove the URL mapping for that folder
  • Return confirmation of the deletion

2. Implementation Details

  • The script should work with a cloud asset management service
  • Use environment variables for configuration (cloud credentials should be read from environment)
  • Include proper error handling for operations that may fail
  • Each function should return meaningful status information

3. Test Cases { .test-cases }

Create a test file test_url_manager.py with the following test cases:

Test 1: Create and list mappings { .test-case @test }

# Create a mapping for "products" folder to "http://cdn.example.com/products"
create_mapping("products", "http://cdn.example.com/products")

# List all mappings
mappings = list_mappings()

# Verify the mapping exists in the list
assert any(m['folder'] == 'products' and
           m['template'] == 'http://cdn.example.com/products'
           for m in mappings)

Test 2: Update an existing mapping { .test-case @test }

# First create a mapping
create_mapping("gallery", "http://cdn.example.com/gallery")

# Update it with a new URL template
update_mapping("gallery", "http://cdn2.example.com/gallery")

# List and verify the update
mappings = list_mappings()
mapping = next((m for m in mappings if m['folder'] == 'gallery'), None)

assert mapping is not None
assert mapping['template'] == 'http://cdn2.example.com/gallery'

Test 3: Delete a mapping { .test-case @test }

# Create a mapping
create_mapping("temp", "http://cdn.example.com/temp")

# Delete it
delete_mapping("temp")

# Verify it's removed
mappings = list_mappings()
assert not any(m['folder'] == 'temp' for m in mappings)

Dependencies { .dependencies }

cloudinary { .dependency }

Provides cloud-based image and video management capabilities including URL routing configuration.