123456789101112131415161718192021 |
- import requests
- from typing import Mapping
- def get_code(file_path: str) -> dict:
- upload_address = "http://123.57.163.80:2119/v1/images/verify"
- with open(file_path, 'rb') as f:
- image_bytes = f.read()
- content = {'file': image_bytes}
- # json_resp = get_verify_code(upload_address, content)
- headers = {'accept': 'application/json'}
- response = requests.post(upload_address, headers=headers, files=content, stream=True)
- return response.json()
- def get_code_det(image_bytes) -> dict:
- upload_address = "http://123.57.163.80:2119/v1/images/verify_det"
- content = {'image_content': image_bytes}
- headers = {'accept': 'application/json'}
- response = requests.post(upload_address, headers=headers, files=content, stream=True)
- return response.json()
|