Git Product home page Git Product logo

Comments (7)

ZhymabekRoman avatar ZhymabekRoman commented on July 3, 2024

requests doesn't supports HTTP/2, probably that's why it's throws exception ChunkedEncodingError. Or there is some problem in server side. Anyway, if we send exactly same request with curl, we get useful information about error itself:

{"error":"direction_invalid","errorType":"validation"}⏎

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on July 3, 2024

@reddere, as a workaround, please specify the source language of the text, as Reverso recognises text in Catalan. However, the translate endpoint doesn't support Catalan translation:

from translatepy.translators.reverso import ReversoTranslate

translator = ReversoTranslate()

text = 'Una manera única de conseguir la victoria\n\nJonesyTheGoat'
t = translator.translate(text, 'Italian', 'Spanish')
print(t)

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on July 3, 2024

I made some investigation and came to conclusion that when we send request from Chromium, even from Icnognito mode, Reverso correctly detects language as Spanish, if we export same request as curl format from Network tab of Devtool and execute it in terminal, we get Catalon language as in requests result. Probably Reverso uses some fingerprinting algorithm to detect the source of incoming requests, I have no better explanations.

from translate.

reddere avatar reddere commented on July 3, 2024

I deeply appreciate the insightful replies @ZhymabekRoman . Unfortunately I cannot set the source language as I'm using the translator to translate from multiple languages (english, spanish and german mainly) to italian. If reverso detects the source of incoming requests, will passing a Chromium User-Agent in headers work?

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on July 3, 2024

will passing a Chromium User-Agent in headers work?

Nope

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on July 3, 2024

As a workaround, I think you can use Google to detect the language and pass it to Reverso for translation.

from translate.

Animenosekai avatar Animenosekai commented on July 3, 2024

Hmm requests.exceptions.ChunkedEncodingError is not really common, might need to investigate a bit

from translate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.