mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-28 06:06:34 +08:00
Test: Added test cases for Update Documents HTTP API (#6106)
### What problem does this PR solve? cover [update documents endpoints](https://ragflow.io/docs/dev/http_api_reference#update-document) ### Type of change - [x] add test cases
This commit is contained in:
@ -88,18 +88,25 @@ def upload_documnets(auth, dataset_id, files_path=None):
|
||||
files_path = []
|
||||
|
||||
fields = []
|
||||
for i, fp in enumerate(files_path):
|
||||
p = Path(fp)
|
||||
fields.append(("file", (p.name, p.open("rb"))))
|
||||
m = MultipartEncoder(fields=fields)
|
||||
file_objects = []
|
||||
try:
|
||||
for fp in files_path:
|
||||
p = Path(fp)
|
||||
f = p.open("rb")
|
||||
fields.append(("file", (p.name, f)))
|
||||
file_objects.append(f)
|
||||
m = MultipartEncoder(fields=fields)
|
||||
|
||||
res = requests.post(
|
||||
url=url,
|
||||
headers={"Content-Type": m.content_type},
|
||||
auth=auth,
|
||||
data=m,
|
||||
)
|
||||
return res.json()
|
||||
res = requests.post(
|
||||
url=url,
|
||||
headers={"Content-Type": m.content_type},
|
||||
auth=auth,
|
||||
data=m,
|
||||
)
|
||||
return res.json()
|
||||
finally:
|
||||
for f in file_objects:
|
||||
f.close()
|
||||
|
||||
|
||||
def batch_upload_documents(auth, dataset_id, num, tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user