http://"+IP+":8080/Request.cgi?%s" % params, data)
我覺得出問題的地方可能在於檔案附加的方式或是post的參數給錯
抓參數名的方法是用firebug查看
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.169.210.171
※ 編輯: hl4 來自: 118.169.210.171 (05/11 21:36)
最近我用python作一些操作網頁介面的事情
說的明確一點就是丟一些http get/post request,然後讀取回應
主要用的是urllib,沒有特別理由,純粹因為剛好找到可行的範例
但是,我在上傳檔案的時候遇到了問題
我的方法是將檔案用read的方式倒出來,用post的方式加在檔案後面,urlopen丟出去
params = urllib.urlencode({'sid':sid, 'count':random.random()})
with open(file, "r") as f:
tempfile = f.read()
data = urllib.urlencode({'file':tempfile})
f = urllib.urlopen("