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 simple HTTP API client authentication module that handles user credentials and generates proper authorization headers for API requests.
Your module should provide functionality to prepare authentication headers for HTTP requests to various APIs. The system needs to:
The module should support authentication for two different API services:
When authenticating to the Standard ASCII API with username "admin" and password "secret123", the returned header dictionary should contain an "Authorization" key with the correct Basic Authentication value @test
When authenticating to the International API with username "用户" (Chinese for "user") and password "пароль" (Russian for "password"), the returned header dictionary should contain an "Authorization" key with the correct UTF-8 encoded Basic Authentication value @test
The authentication header values should be properly formatted according to HTTP Basic Authentication standards (Base64 encoded username:password combination) @test
@generates
def generate_standard_auth_header(username: str, password: str) -> dict:
"""
Generate authentication header for Standard ASCII API.
Args:
username: The username for authentication
password: The password for authentication
Returns:
Dictionary containing the Authorization header
"""
pass
def generate_international_auth_header(username: str, password: str) -> dict:
"""
Generate authentication header for International API with UTF-8 support.
Args:
username: The username for authentication (may contain international characters)
password: The password for authentication (may contain international characters)
Returns:
Dictionary containing the Authorization header
"""
passProvides web-related utility functions including HTTP authentication support.