Uploading multiple files in a single request using python requests module

前端 未结 6 612
南笙
南笙 2020-12-04 19:49

The Python requests module provides good documentation on how to upload a single file in a single request:

 files = {\         


        
6条回答
  •  独厮守ぢ
    2020-12-04 20:14

    To upload a list of files with the same key value in a single request, you can create a list of tuples with the first item in each tuple as the key value and the file object as the second:

    files = [('file', open('report.xls', 'rb')), ('file', open('report2.xls', 'rb'))]
    

提交回复
热议问题