#coding:utf-8 import htmllib import httplib2 import httplib h1 = httplib.HTTPConnection("www.python.org") h1.request("GET", "/") r1 = h1.getresponse() print r1.status, r1.reason data1 = r1.read() print data1 import httplib, urllib params = urllib.urlencode({‘@number‘: 12524, ‘@type‘: ‘issue‘, ‘@action‘: ‘show‘}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTTPConnection("bugs.python.org") conn.request("POST", "", params, headers) response = conn.getresponse() print response.status, response.reason data = response.read()
时间: 2024-12-25 20:31:38