import unittest import requests url = 'http://localhost:8080/detect' def send_request(image_path): b_img_list = [] f = open(image_path, "rb") b_img_list.append(('file_list', ('01'+'.jpg', f, 'images/jpg'))) payload = {'model_name': 'ocr-layout', 'img_size': 1824, 'download_image': False} r = requests.post(f'{url}', headers={}, data=payload, files=b_img_list) print(r.json()) return r.json() class TestLayout(unittest.TestCase): def test_01(self): r = send_request('../images/01.jpg') self.assertEqual(r['status'], '000', 'status case error') if __name__ == '__main__': unittest.main()