I’m calling this url from php side $filenames is a variable to pass filename
$url='http://localhost/python-server/websocket/test_words.py?filename='.$filenames;
i want to get this filename parameter in my python client script.
Python script:
import asyncio
import websockets
import sys
import wave
import json
import requests
import io
async def run_test(uri):
async with websockets.connect(uri) as websocket:
wf = wave.open('test.wav', "rb")
await websocket.send('''{"config" :
{ "phrase_list" : ["zero one two three four five", "six seven eight nine oh"],
"sample_rate" : %d,
"words" : 0}}''' % (wf.getframerate()))
results = []
buffer_size = int(wf.getframerate() * 0.2) # 0.2 seconds of audio
while True: