Skip to content

Instantly share code, notes, and snippets.

@thejungwon
Created October 5, 2020 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejungwon/fea7e7aae5db3052b873f0916d1dd6b6 to your computer and use it in GitHub Desktop.
Save thejungwon/fea7e7aae5db3052b873f0916d1dd6b6 to your computer and use it in GitHub Desktop.
import sys
import requests
client_id = "<YOUR_CLIENT_ID>"
client_secret = "<YOUR_CLIENT_SECRET>"
lang = "Kor" # 언어 코드 ( Kor, Jpn, Eng, Chn )
url = "https://naveropenapi.apigw.ntruss.com/recog/v1/stt?lang=" + lang
data = open('1111.mp3', 'rb')
headers = {
"X-NCP-APIGW-API-KEY-ID": client_id,
"X-NCP-APIGW-API-KEY": client_secret,
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=data, headers=headers)
rescode = response.status_code
if(rescode == 200):
print (response.text)
else:
print("Error : " + response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment