import os, json import requests API_ENDPOINT = os.environ.get("API_ENDPOINT") TOKEN = os.environ.get("TOKEN") headers = { 'accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': f'Bearer {TOKEN}' } def get_health(): response = requests.get(API_ENDPOINT, headers=headers) return response.json() def handle_url(url, from_lang, to_lang, gender): data = { 'url': url, 'from_lang': from_lang, 'to_lang': to_lang, 'gender': gender, } response = requests.post(f'{API_ENDPOINT}/synthesise_video_url', headers=headers, data=json.dumps(data)) return response.json() def test_response(): response = { "srt_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/subtitle.srt", "video_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/translated_video.mp4", "translated_srt_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/translated_subtitle.srt", "translated_audio_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/translated_audio.mp3", } return response