0
複数のフォームパラメータを指定する必要があるプロジェクトを処理しています。どちらがファイルそのものかを指定します。要求に応じて複数のフォームパラメータを送信するにはどうすればよいですか?
私が試した何:
import requests
REST_URL = 'http://192.168.150.138:8888/tasks/create/file'
with open(os.path.join('/home/default/Batch/Samples/', filename),'rb') as sample:
files = {'file' :("temp_file_name" , sample)}
r = requests.post(REST_URL , files=files)
問題:
私がいる場合と仮定し
file (required) - sample file (multipart encoded file content)
package (optional) - analysis package to be used for the analysis
timeout (optional) (int) - analysis timeout (in seconds)
priority (optional) (int) - priority to assign to the task (1-3)
options (optional) - options to pass to the analysis package
machine (optional) - label of the analysis machine to use for the analysis
platform (optional) - name of the platform to select the analysis machine from (e.g. “windows”)
(これらのすべては、フォームパラメータです)このような追加情報を渡す必要があります私もこのように作成することができます形式でマシン名を送信したいですか?
data = {'machine' :'machine_name'}
r =requests.post(EST_URL , files=files,data=data)
任意の提案が役立ちます。
はい、インポートが修正さDAS-Gタイプ@ –
を要求 –