1
我想從這個代碼在Python二郎神切換:從Python的httplib的二郎神httpc
的Python:
import httplib
body="<xml>...</xml>"
headers = { \
"Accept" : "text/*" , \
"User-Agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" , \
"Host" : "something.com" , \
"Content-Length" : str(len(body)) , \
"Connection" : "Keep-Alive" , \
"Cache-Control" : "no-cache" , \
}
server="something.com"
url="/s.srf"
conn = httplib.HTTPSConnection(server,443)
conn.request("POST", url, body, headers)
- >我已經試過這二郎:
Headers=[
{"Accept","text/*"},
{"User-Agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"},
{"Host","something.com"},
{"Content-Length",string:len(Body)},
{"Connection","Keep-Alive"},
{"Cache-Control","no-cache"}
].
httpc:request(post,{Server,Headers,[],Body},[],[]).
但我不知道我可以把網址「/s.srf」放在哪裏,有什麼想法?
感謝埃米爾我已經試過,但不起作用。 – user1524704 2012-07-14 18:09:44
你有錯誤信息嗎? – 2012-07-14 18:32:25
這是一個關閉的服務器,錯誤是「無效的請求」。 – user1524704 2012-07-14 20:56:19