: 내가 브라우저에서 실행 http://www.w3schools.com/php/php_forms.asp나는 다음과 같은 예를 사용
, 내가 브라우저에서 결과를 참조 :
Welcome John
Your email address is [email protected]
내가 파이썬 POST를 실행하면 HTTP 요청 :
:import httplib, urllib
params = urllib.urlencode({'@name': 'John','@email': '[email protected]'})
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/html"}
conn = httplib.HTTPConnection("10.0.0.201")
conn.request("POST","/welcome.php",params, headers)
response = conn.getresponse()
print "Status"
print response.status
print "Reason"
print response.reason
print "Read"
print response.read()
conn.close()
나는 다음을 참조
Status
200
Reason
OK
Read
<html>
<body>
Welcome <br>
Your email address is:
</body>
</html>
질문 : 파이썬에서 POST 요청 데이터를받는 방법?
'urllib2' 라이브러리가있을 때 수동으로'HTTPConnection'을 구동하는 아픈 루트가 왜 필요한가 또는 ['requests'] (http://docs.python-requests.org/en/latest/)를 설치할 수 있습니까? –