tessl install tessl/pypi-w3lib@2.3.0Library of web-related functions for HTML manipulation, HTTP processing, URL handling, and encoding detection
Agent Success
Agent success rate when using this tile
84%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.91x
Baseline
Agent success rate without this tile
92%
Build a URL parameter manager that updates multiple query parameters in URLs to prepare them for API requests or web scraping tasks.
http://example.com/page?id=123&source=email, updating with parameters {'utm_source': 'newsletter', 'utm_campaign': 'winter2024'} returns http://example.com/page?id=123&source=email&utm_source=newsletter&utm_campaign=winter2024 @testhttp://shop.com/product?item=456, updating with parameters {'ref': 'partner', 'discount': '10'} returns http://shop.com/product?item=456&ref=partner&discount=10 @testhttp://api.example.com/data?format=json&limit=100, updating with parameters {'format': 'xml', 'limit': '50'} returns http://api.example.com/data?format=xml&limit=50 @testhttp://example.com/search?q=old&page=1, updating with parameters {'q': 'new search term', 'page': '5'} returns http://example.com/search?q=new+search+term&page=5 @testhttp://example.com/search?q=python&category=tutorials, updating with parameters {'q': 'web-scraping', 'sort': 'date', 'limit': '20'} returns http://example.com/search?q=web-scraping&category=tutorials&sort=date&limit=20 @testhttp://example.com/page, updating with parameters {'session': 'abc123', 'user': 'guest'} returns http://example.com/page?session=abc123&user=guest @test@generates
def update_url_parameters(url: str, parameters: dict[str, str]) -> str:
"""
Update multiple query parameters in a URL, adding new ones or replacing existing ones.
Args:
url: The URL to modify
parameters: Dictionary of parameter names and values to add or replace
Returns:
str: The modified URL with updated parameters
"""Web utility library providing URL manipulation functions.
@satisfied-by