python发送post请求

python发送post请求代码示例:

import sys import httplib, urllib import traceback def post(params): '发送post请求' result = {'status':500, 'reason':'', 'response':'', 'headers':''} httpClient = None try: data = urllib.urlencode(params['data']) httpClient = httplib.HTTPConnection(params['hostname'], params['port'], timeout=30) if params.has_key('header'): httpClient.request("POST"

阅读全文