Python and Django SDK for Cloudinary, a cloud-based image and video management service with comprehensive transformation, optimization, and delivery capabilities
Overall
score
94%
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.
Implement a script url_manager.py that provides the following functionality:
Create URL Mapping
List All URL Mappings
Update URL Mapping
Delete URL Mapping
Create a test file test_url_manager.py with the following test cases:
# 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)# 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'# 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)Provides cloud-based image and video management capabilities including URL routing configuration.
Install with Tessl CLI
npx tessl i tessl/pypi-cloudinarydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10