Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pons_api.py #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tallesairan
Copy link

Alternative method using the new api.pons.com endpoint in json, I implemented this because the previous method stopped working correctly:

curl 'https://api.pons.com/text-translation-web/v4/translate?locale=en' \
  -H 'authority: api.pons.com' \
  -H 'accept: */*' \
  -H 'accept-language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'origin: https://en.pons.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://en.pons.com/' \
  -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
  --data-raw $'{"impressionId":"48bff56e-aa3f-4463-adb7-8282500be5a4","targetLanguage":"pt","text":"Sweet Victoria Deep","sourceLanguage":"en"}' \
  --compressed

Alternative method using the new api.pons.com endpoint in json, I implemented this because the previous method stopped working correctly:
````bash
curl 'https://api.pons.com/text-translation-web/v4/translate?locale=en' \
  -H 'authority: api.pons.com' \
  -H 'accept: */*' \
  -H 'accept-language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'origin: https://en.pons.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://en.pons.com/' \
  -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
  --data-raw $'{"impressionId":"48bff56e-aa3f-4463-adb7-8282500be5a4","targetLanguage":"pt","text":"Sweet Victoria Deep","sourceLanguage":"en"}' \
  --compressed
````
@nidhaloff
Copy link
Owner

Hi, Thanks for the PR.
Can you add some examples that show how this one solves the issue?
Maybe add a screenshot to show both results (using the current version and then your version)
Also can you add a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants