(self, query_text:str, from_language:str='auto', to_language:str='en', **kwargs)
return data if is_detail_result else data['content']['out']
https://www.iciba.com/fy
        :param query_text: str, must.
        :param from_language: str, default 'auto'.
        :param to_language: str, default 'en'.
        :param **kwargs:
                :param if_ignore_limit_of_length: boolean, default False.
                :param is_detail_result: boolean, default False.
                :param timeout: float, default None.
                :param proxies: dict, default None.
                :param sleep_seconds: float, default `random.random()`.
        :return: str or dict
https://www.iciba.com/fy
        :param query_text: str, must.
        :param from_language: str, default 'auto'.
        :param to_language: str, default 'en'.
        :param **kwargs:
                :param if_ignore_limit_of_length: boolean, default False.
                :param is_detail_result: boolean, default False.
                :param timeout: float, default None.
                :param proxies: dict, default None.
                :param sleep_seconds: float, default `random.random()`.
        :return: str or dict
https : // www . iciba . com / fy : param query_text : str must . : param from_language : str default auto . : param to_language : str default en . : param ** kwargs : : param if_ignore_limit_of_length : boolean default False . : param is_detail_result : boolean default False . : param timeout : float default None . : param proxies : dict default None . : param sleep_seconds : float default random . random () . : return : str or dict
def iciba_api(self, query_text:str, from_language:str='auto', to_language:str='en', **kwargs) -> Union[str,dict]:
        """
        https://www.iciba.com/fy
        :param query_text: str, must.
        :param from_language: str, default 'auto'.
        :param to_language: str, default 'en'.
        :param **kwargs:
                :param if_ignore_limit_of_length: boolean, default False.
                :param is_detail_result: boolean, default False.
                :param timeout: float, default None.
                :param proxies: dict, default None.
                :param sleep_seconds: float, default `random.random()`.
        :return: str or dict
        """
        is_detail_result = kwargs.get('is_detail_result', False)
        timeout = kwargs.get('timeout', None)
        proxies = kwargs.get('proxies', None)
        sleep_seconds = kwargs.get('sleep_seconds', random.random())
        if_ignore_limit_of_length = kwargs.get('if_ignore_limit_of_length', False)
        query_text = self.check_query_text(query_text, if_ignore_limit_of_length)
        delete_temp_language_map_label = 0

        with requests.Session() as ss:
            _ = ss.get(self.host_url, headers=self.host_headers, timeout=timeout, proxies=proxies)
            if not self.language_map:
                self.language_map = self.get_language_map(self.api_url, ss, self.language_headers, timeout, proxies)
            if not self.language_map:
                delete_temp_language_map_label += 1
                self.language_map = self.make_temp_language_map(from_language, to_language)
            from_language, to_language = self.check_language(from_language, to_language, self.language_map, output_zh=self.output_zh)

            sign = hashlib.md5(f"6key_cibaifanyicjbysdlove1{query_text}".encode()).hexdigest()[:16]
            params = {'c': 'trans', 'm': 'fy', 'client': 6, 'auth_user': 'key_ciba', 'sign': sign}
            form_data = {'from': from_language, 'to': to_language, 'q': query_text}
            r = ss.post(self.api_url, headers=self.api_headers, params=params, data=form_data, timeout=timeout, proxies=proxies)
            r.raise_for_status()
            data = r.json()

        if delete_temp_language_map_label != 0:
            self.language_map = None
        time.sleep(sleep_seconds)
        self.query_count += 1
        return data if is_detail_result else data['content']['out']
def iciba_api ( self , query_text : str , from_language : str = 'auto' , to_language : str = 'en' , * * kwargs ) -> Union [ str , dict ] : is_detail_result = kwargs . get ( 'is_detail_result' , False ) timeout = kwargs . get ( 'timeout' , None ) proxies = kwargs . get ( 'proxies' , None ) sleep_seconds = kwargs . get ( 'sleep_seconds' , random . random ( ) ) if_ignore_limit_of_length = kwargs . get ( 'if_ignore_limit_of_length' , False ) query_text = self . check_query_text ( query_text , if_ignore_limit_of_length ) delete_temp_language_map_label = 0 with requests . Session ( ) as ss : _ = ss . get ( self . host_url , headers = self . host_headers , timeout = timeout , proxies = proxies ) if not self . language_map : self . language_map = self . get_language_map ( self . api_url , ss , self . language_headers , timeout , proxies ) if not self . language_map : delete_temp_language_map_label += 1 self . language_map = self . make_temp_language_map ( from_language , to_language ) from_language , to_language = self . check_language ( from_language , to_language , self . language_map , output_zh = self . output_zh ) sign = hashlib . md5 ( f"6key_cibaifanyicjbysdlove1{query_text}" . encode ( ) ) . hexdigest ( ) [ : 16 ] params = { 'c' : 'trans' , 'm' : 'fy' , 'client' : 6 , 'auth_user' : 'key_ciba' , 'sign' : sign } form_data = { 'from' : from_language , 'to' : to_language , 'q' : query_text } r = ss . post ( self . api_url , headers = self . api_headers , params = params , data = form_data , timeout = timeout , proxies = proxies ) r . raise_for_status ( ) data = r . json ( ) if delete_temp_language_map_label != 0 : self . language_map = None time . sleep ( sleep_seconds ) self . query_count += 1 return data if is_detail_result else data [ 'content' ] [ 'out' ]