

import requests

import time
import json
session = requests.Session()
def post_request():

    for _ in range(100):
        start_time = time.time()
        _json = {"test":1,"sentence":"testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"}
        resp = session.post("http://localhost:17130/embedding", json=_json)

        if resp.status_code==200:
            content = resp.content.decode("utf-8")
            _d = json.loads(content)
            if _d.get("success"):
                print(resp.status_code,_d.get("success"),time.time()-start_time)


if __name__ == '__main__':
    post_request()