음성 합성 API를 사용해보려고 하는데 계속 403만 반환됩니다. Python으로 시도했다가 안되서 curl로도 테스트를 해보고 있는데 똑같이 403만 반환되네요. 다음은 제가 테스트 해 본 명령어와 결과입니다. {REST_API_KEY} 부분은 애플리케이션을 만들고 받은 REST API 키를 사용했습니다.
curl -v -X POST "https://kakaoi-newtone-openapi.kakao.com/v1/synthesize" \
-H "Content-Type: application/xml" \
-H "Authorization: KakaoAK {REST_API_KEY}" \
-d "<speak><voice name="MAN_DIALOG_BRIGHT">잘 지냈어? 나도 잘 지냈어.</voice></speak>" > result.mp3
Note: Unnecessary use of -X or --request, POST is already inferred.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 121.53.202.215...
* TCP_NODELAY set
* Connected to kakaoi-newtone-openapi.kakao.com (121.53.202.215) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [246 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [91 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3956 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [262 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / AES256-SHA
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=KR; ST=Jeju-do; L=Jeju-si; O=Kakao Corp.; CN=*.kakao.com
* start date: Sep 10 00:00:00 2020 GMT
* expire date: Oct 11 12:00:00 2021 GMT
* subjectAltName: host "kakaoi-newtone-openapi.kakao.com" matched cert's "*.kakao.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=Thawte TLS RSA CA G1
* SSL certificate verify ok.
> POST /v1/synthesize HTTP/1.1
> Host: kakaoi-newtone-openapi.kakao.com
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/xml
> Authorization: KakaoAK {REST_API_KEY}
> Content-Length: 89
>
} [89 bytes data]
* upload completely sent off: 89 out of 89 bytes
< HTTP/1.1 403 Forbidden
< Server: openresty
< Date: Thu, 19 Nov 2020 12:57:13 GMT
< Content-Type: application/json; charset=UTF-8
< Content-Length: 57
< Connection: keep-alive
< X-Tts-Session-Id: 298096c5c44df6018a5393f2026ff1240d325396
<
{ [57 bytes data]
100 146 100 57 100 89 982 1534 --:--:-- --:--:-- --:--:-- 2517
* Connection #0 to host kakaoi-newtone-openapi.kakao.com left intact
* Closing connection 0