Skip to content

Instantly share code, notes, and snippets.

@Bill-Park
Last active July 7, 2019 05:28
Show Gist options
  • Save Bill-Park/f3e8f9c26321aba1810fc89633e6aca7 to your computer and use it in GitHub Desktop.
Save Bill-Park/f3e8f9c26321aba1810fc89633e6aca7 to your computer and use it in GitHub Desktop.
import os
import sys
import requests
import json
tts_text = "안녕하세요 네이버"
client_id = "id"
client_secret = "secret"
url = "https://naveropenapi.apigw.ntruss.com/voice/v1/tts"
datas = {
"speaker" : "mijin",
"speed" : "0",
"text" : tts_text
}
headers = {
"X-NCP-APIGW-API-KEY-ID": client_id,
"X-NCP-APIGW-API-KEY": client_secret,
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=datas, headers=headers)
with open(file_name, 'wb') as f:
f.write(response.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment