Multiple files
@router.post('files')
def post_files(files_multiple: List[UploadFIle]):
return do_something(files_multiple)
import requests
with open(fpath0, 'rb') as file0, \
open(fpath1, 'rb') as file1, \
open(fpath2, 'rb') as file2:
files = [
('files_multiple', file0), \
('files_multiple', file1), \
('files_multiple', file2)
]
res = requests.post(url, files=files)
Single File
import requests
with open(fpath0, 'rb') as file0:
file = {'file': file0}
res = requests.post(url, files=file)