Skip to content

Instantly share code, notes, and snippets.

@dobestan
Created October 6, 2016 13:33
Show Gist options
  • Select an option

  • Save dobestan/48f27a2e4e050c57361d50da5f2cc6fe to your computer and use it in GitHub Desktop.

Select an option

Save dobestan/48f27a2e4e050c57361d50da5f2cc6fe to your computer and use it in GitHub Desktop.
def translate(text):
url = "https://openapi.naver.com/v1/language/translate"
headers = {
"X-Naver-Client-Id": "qrVxa5mKgpHMD2BjCoQ6",
"X-Naver-Client-Secret": "qIBci5xv2c"
}
data = {
"source": "ko",
"target": "en",
"text": text
}
response = requests.post(url, headers=headers, data=data)
result = response.json().get("message").get("result").get("translatedText")
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment