码迷,mamicode.com
首页 > 编程语言 > 详细

httplib-Python

时间:2016-03-16 17:24:49      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:

#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()

  

httplib-Python

标签:

原文地址:http://www.cnblogs.com/linbinqiang/p/5283920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!