Zoom のWeb サイトの指示に従おうとしましたが、キャプションを送信しようとするたびに 400 エラーが返されます。
{"timestamp":1594640701018,"status":400,"error":"Bad Request","message":"No message available","path":"/closedcaption"}
ドキュメントには、会議がまだ開始されていないときに 400 が返されると記載されていますが、私のテスト シナリオでは、2 台のデバイスが会議に接続されており、ホストからクローズド キャプション API トークンをコピーしてからテスト プログラムに渡しています。 . 私が知る限り、それは開始された会議なので、何か別の予定があるに違いありません。リクエストを複数回送信しようとしましたが、それでも 400 エラーが返されます。
私は Python 3 を使用しており、 と の両方を試しましurllib.request
たhttp.client
が、役に立ちませんでした。私は何が欠けていますか?
import urllib.request
import http.client
third_party_api_token = input('Third Party CC Token: ')
domain = third_party_api_token.split('/')[2]
if 'https://' in third_party_api_token:
domain = domain + ':443'
else:
domain = domain + ':80'
seq = 1
while True:
input('Press Enter to continue')
formatted_url = '{}&lang=en-US&seq={}'.format(zoom_cc_url, seq)
# formatted_text = 'Hello World\n'.encode('utf-8')
formatted_text = 'Hello World\n'
headers = {'Content-Type':'text/plain'}
print(domain)
print(formatted_url)
try:
# r = urllib.request.Request(formatted_url, data=formatted_text, headers=headers, method='POST')
# with urllib.request.urlopen(r) as response:
# print(response.read().decode('utf-8'))
conn = http.client.HTTPSConnection(domain)
conn.request("POST", formatted_url.replace(domain, ''), body=formatted_text, headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
except Exception as e:
print(e)
seq += 1