parent
c2b2fb715a
commit
02f5ac24b8
@ -0,0 +1,21 @@
|
|||||||
|
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'])
|
Binary file not shown.
Loading…
Reference in new issue