An unofficial Google Translate API for Python providing free text translation and language detection capabilities
Overall
score
100%
Evaluation — 100%
↑ 1.01xAgent success when using this tile
Build a Python translation service that can operate behind corporate proxies with authentication requirements.
@generates
Your service should:
Create a TranslatorService class that:
The service should work with various proxy formats including:
"http://proxy.company.com:8080""http://proxy.example.com:8080" and translating "hello" to Spanish returns translated text @testfrom typing import Union, Dict
from httpx import Proxy
class TranslatorService:
"""Translation service that operates through configured proxies."""
def __init__(self, proxy: Union[str, Dict[str, str], Proxy]):
"""
Initialize the translator service with proxy configuration.
Args:
proxy: Proxy configuration - can be:
- String URL: "http://proxy.com:8080"
- Dict with scheme keys: {"http://": "...", "https://": "..."}
- httpx.Proxy object with authentication
"""
pass
async def translate(self, text: str, dest: str = 'en', src: str = 'auto') -> str:
"""
Translate text through the configured proxy.
Args:
text: Text to translate
dest: Destination language code
src: Source language code (default: 'auto' for auto-detection)
Returns:
Translated text
"""
pass
def update_proxy(self, proxy: Union[str, Dict[str, str], Proxy]):
"""
Update the proxy configuration.
Args:
proxy: New proxy configuration in any supported format
"""
pass
async def __aenter__(self):
"""Async context manager entry."""
pass
async def __aexit__(self, exc_type, exc_val, exc_tb):
"""Async context manager exit."""
passProvides translation capabilities with proxy support.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-googletrans@4.0.0docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10