updated
This commit is contained in:
@@ -43,8 +43,9 @@ local function playTTSFile(value)
|
||||
local headers = {
|
||||
["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
}
|
||||
|
||||
print("Sending HTTP POST request")
|
||||
local response = http.request({
|
||||
local response = http.post({
|
||||
url = ttsRoute,
|
||||
method = "POST",
|
||||
body = body,
|
||||
@@ -52,20 +53,10 @@ local function playTTSFile(value)
|
||||
binary = false
|
||||
})
|
||||
|
||||
-- Wait for the response
|
||||
local event, resUrl, handle
|
||||
repeat
|
||||
event, resUrl, handle = os.pullEvent()
|
||||
if event == "http_failure" and resUrl == url then
|
||||
print("HTTP POST request failed for: " .. resUrl)
|
||||
return
|
||||
end
|
||||
until event == "http_success" and resUrl == url
|
||||
print("HTTP POST request successful" )
|
||||
-- Read and parse response
|
||||
local data = handle.readAll()
|
||||
local data = response.readAll()
|
||||
print(data)
|
||||
handle.close()
|
||||
response.close()
|
||||
end
|
||||
|
||||
local function createSoundFile(fileName)
|
||||
|
||||
Reference in New Issue
Block a user