I have looked at the other messages about Google Translate Enterprise API but none appear to provide syntax that works. My facts are these. I have a Google Enterprise account. I received a project id and an API-key. To test that and see if it worked, I used the python script shown on this page: https://cloud.google.com/docs/authentication/api-keys
. That worked. Then, I authorized Google Translate API in my google cloud portal. I believe I authorized this API-Key to work with that API in the google enterprise portal associated with this project-id. I then looked for examples of how to actually contact that API, but struggled a lot. For example, I see this script here https://cloud.google.com/translate/docs/basic/detecting-language
but this assumes you have already authenticated, and it refers you to a page about authentication that apparently works for some libraries but doesn’t work for Google Translate. So… then I looked for other sources and I found some examples where people tried just making http requests in this format:
import requests
my_request = requests.request('GET',"https://translation.googleapis.com/language/translate/v2?key='MY API KEY'?target='en'")
There are two issues with this. First, I don’t see how you pass the actual string you are trying to translate. The documentation says it’s passed as ‘q’, but I tried that and got a ‘malformed’ request error. Second, it’s saying that the API key is invalid, even though it worked to do sentiment analysis (the first link above).
Can anyone share actual syntax of what an http request to Google Translate should look like (replacing the API-Key with MY-API-KEY)?