You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
460 B

import json
import requests
from Config import *
url = DIFY_URL + "/files/upload"
payload = {'user': 'abc-123'}
files = [
('file', ('1.png', open(r'D:\KeCheng\BaiHu\TestImage\1.png', 'rb'), 'image/png'))
]
headers = {
'Authorization': 'Bearer ' + DIFY_API_KEY
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
json_data = json.loads(response.text)
print(json_data)
print(json_data['id'])