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

translation API doesn't work in python2.7? #1

Open
yangpancn opened this issue Jun 9, 2018 · 0 comments
Open

translation API doesn't work in python2.7? #1

yangpancn opened this issue Jun 9, 2018 · 0 comments

Comments

@yangpancn
Copy link

yangpancn commented Jun 9, 2018

I am developing an web App that calls the Text Translation API. My whole project is developed in Python2.7 so I try to call the APIs in Python2.7. But I always get the failure result:

send: 'POST /translate?api-version=3.0&to=zh HTTP/1.1\r\nHost: api.cognitive.microsofttranslator.com\r\nAccept-Encoding: identity\r\nContent-Length: 19\r\nOcp-Apim-Subscription-Key: [my-sub-key]\r\nContent-type: application/json\r\nX-ClientTraceId: 7ade7c69-7100-4afb-8bb7-676d594637c4\r\n\r\n'
send: '[{"Text": "Hello"}]'
DEBUG:root:
reply: 'HTTP/1.1 404 Not Found\r\n'

My code is in https://github.com/yangpancn/alchemy/blob/master/ms_translator.py

could someone provide a demo code how to use the API in python2.7?
Thanks in advance!

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

No branches or pull requests

1 participant