@@ -34,15 +34,15 @@ def validate_engine_id(cls, v: Optional[str]) -> Optional[str]:
3434 @validator ("api_url" , pre = True , always = True )
3535 @classmethod
3636 def validate_api_url (cls , v : Optional [str ], values : Dict [str , Any ]) -> str :
37- if v is None or v == "https://engine.lingo.dev" :
38- engine_id = values .get ("engine_id" )
39- if engine_id :
40- return "https://api.lingo.dev"
37+ default_url = "https://engine.lingo.dev"
4138 if v is None :
42- return "https://engine.lingo.dev"
39+ v = default_url
4340 if not v .startswith (("http://" , "https://" )):
4441 raise ValueError ("API URL must be a valid HTTP/HTTPS URL" )
45- return v .rstrip ("/" )
42+ v = v .rstrip ("/" )
43+ if v == default_url and values .get ("engine_id" ):
44+ return "https://api.lingo.dev"
45+ return v
4646
4747
4848class LocalizationParams (BaseModel ):
@@ -600,6 +600,7 @@ async def quick_translate(
600600 source_locale: Source language code (optional, auto-detected if None)
601601 api_url: API endpoint URL
602602 fast: Enable fast mode for quicker translations
603+ engine_id: Optional engine ID for vNext API.
603604
604605 Returns:
605606 Translated content (same type as input)
@@ -619,7 +620,7 @@ async def quick_translate(
619620 "es"
620621 )
621622 """
622- config : Dict [ str , Any ] = {
623+ config = {
623624 "api_key" : api_key ,
624625 "api_url" : api_url ,
625626 }
@@ -662,6 +663,7 @@ async def quick_batch_translate(
662663 source_locale: Source language code (optional, auto-detected if None)
663664 api_url: API endpoint URL
664665 fast: Enable fast mode for quicker translations
666+ engine_id: Optional engine ID for vNext API.
665667
666668 Returns:
667669 List of translated content (one for each target locale)
@@ -674,7 +676,7 @@ async def quick_batch_translate(
674676 )
675677 # Results: ["Hola mundo", "Bonjour le monde", "Hallo Welt"]
676678 """
677- config : Dict [ str , Any ] = {
679+ config = {
678680 "api_key" : api_key ,
679681 "api_url" : api_url ,
680682 }
0 commit comments