Skip to content

Create pons_api.py - #243

Open
tallesairan wants to merge 1 commit into
nidhaloff:masterfrom
tallesairan:patch-2
Open

Create pons_api.py#243
tallesairan wants to merge 1 commit into
nidhaloff:masterfrom
tallesairan:patch-2

Conversation

@tallesairan

Copy link
Copy Markdown

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
Copy Markdown
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