Closed kekwak closed 3 months ago
@kekwak Bro, look this: https://github.com/UlionTse/translators/issues/157#issuecomment-2061506773
The same problem, one, is that it is not clear what the input text is. Second, whether this bug can be reproduced. Third, through the parameters is_detail_result=True
, see what the server returned.
{'http_code': 200, 'message': 'Token expired', 'err_code': None, 'details': None, 'auth_code': -3}
,
Noting this, it is recommended that you use parameters update_session_after_freq
and update_session_after_seconds
to update the session and other cached values early.
I tried to use update_session_after_freq
and update_session_after_seconds
, but still got this error
out = ts.server.caiyun(
textz, translator='caiyun', from_language='en', to_language='ru',
update_session_after_freq=1, update_session_after_seconds=5,
)
with is_detail_result=True I've got this:
{'http_code': 200, 'message': 'Token expired', 'err_code': None, 'details': None, 'auth_code': -3}
text, that I've used:
'As the hours pass and the days unfold from the mysterious image that captivates with its futuristic and abstract allure, a series of events begin to unravel in a mesmerizing dance of technology and spirituality.\n\nThe central figure, exuding an aura of profound significance akin to a deity or spiritual being, seems to emanate a powerful energy that pulses through the surroundings. The symbols and objects surrounding this enigmatic figure come to life, shimmering with an otherworldly glow as if unlocking hidden secrets of the universe.\n\nThe silhouette of a person, glowing with a celestial blue light, stands at the forefront, their presence commanding attention amidst the intricate network of symbols and shapes. A large circular object beams with a mesmerizing blue light, casting a soft, enchanting glow that intertwines with the complex patterns scattered throughout the background.\n\nAs time unfolds, the deep shades of purple blend with the ethereal blues and pinks, creating a dreamlike ambiance that hints at revelations beyond comprehension. The eyes, triangles, and geometric shapes pulse with a rhythmic energy, as if propelling the narrative towards a climactic revelation.\n\nWithin this enigmatic setting, a subtle tension builds, hinting at a convergence of forces beyond human understanding. The interplay of light and shadow, of ancient symbols and futuristic motifs, sets the stage for a profound awakening, a moment where the boundaries between the physical and the metaphysical blur into a harmonious symphony of existence.\n\nAs the days stretch ahead, the image remains a portal to a realm where technology and spirituality converge in a dance of cosmic proportions. Each symbol, each object holds a key to a deeper truth waiting to be unlocked, promising a journey of enlightenment and transformation for those brave enough to venture into its enigmatic depths.'
Speaking about bug reproducing, try to hold you prog for a while, I use it in telegram bot and after some time this issue appears. It this way I'm not able use it, that's why I have to restart my bot, then it starts working.
@kekwak Bro Once it is identified by anti-crawlers due to frequent requests, the impact will be directly on the IP address level. Therefore, any parameter you change within a short period of time will be invalid. The two parameters I suggest you use are not that the smaller the value, the better. If it is too small, it will obviously be regarded as a crawler. If it is too large, it will not meet the browser session time. It is necessary to set an appropriate size.
Debug Tips
What happened?
i tried to print data in module before bug happens
so i got
{'http_code': 200, 'message': 'Token expired', 'err_code': None, 'details': None, 'auth_code': -3}
i use
caiyun
:out = ts.translate_text(text, translator='caiyun', from_language='en', to_language='ru')
APP Version
5.9.1
Python Version
3.11
Runtime Environment
Windows 11
Country/Region
Russia
Relevant log output
Screenshots
No response
Code of Conduct