如何用python寫后臺接收客戶端發(fā)送的post請求?
import urllib2import urllib #定義一個要提交的數(shù)據(jù)數(shù)組(字典)data = {}data['username'] = 'zgx030030'data['password'] = '123456' #定義post的地址url = ' test.com/post/'post_data = urllib.urlencode(data) #提交,發(fā)送數(shù)據(jù)req = urllib2.urlopen(url, post_data) #獲取提交后返回的信息content = req.read()