Chuyển tới nội dung chính

Nhập hình ảnh vào Ảnh

  • Mô tả giao diện

    POST /image_to_album HTTP/1.1

    [dữ liệu nhị phân của hình ảnh]
  • Phản hồi có thể có

    {"code":0,"message":"操作成功"}
    {"code":1,"message":"操作失败"}
  • Ví dụ phía máy tính bằng Python 3.x:

    # -*- coding: utf-8 -*-
    import http.client
    import json

    imgf = open('r:/1.png', 'rb') # đường dẫn tệp hình ảnh
    imgdata = imgf.read()

    conn = http.client.HTTPConnection("192.168.31.72:46952") # địa chỉ và cổng của thiết bị
    conn.request("POST", "/image_to_album", imgdata)

    response = conn.getresponse()

    if response.status == 200:
    ret = json.loads(response.read().decode('utf-8')) # giải mã rõ ràng bằng UTF-8
    print(ret['message'])
    else:
    print(response.status, response.reason)
    print(response.read().decode('utf-8')) # giải mã rõ ràng bằng UTF-8

    conn.close()
  • Lưu ý

    • Định dạng được hỗ trợ: PNG, JPG