voice_detection / test_details.py
ranar110
Initial commit of Voice Detection System
37c6d1c
raw
history blame contribute delete
746 Bytes
import requests
def test_api_with_url():
url = "http://127.0.0.1:8000/detect"
headers = {"x-api-key": "my_secret_key_123"}
data = {
"message": "Testing audio URL",
"audio_url": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" # A public sample
}
print("Testing with audio_url...")
try:
response = requests.post(url, headers=headers, data=data)
if response.status_code == 200:
print("PASS: Request successful")
print(response.json())
else:
print(f"FAIL: Status {response.status_code}")
print(response.text)
except Exception as e:
print(f"FAIL: {e}")
if __name__ == "__main__":
test_api_with_url()