from urllib.request import urlopen
for line in urlopen('http://www.baidu.com/'):
print(line)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
import http.client
cHeader = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0',
'Host':'www.baidu.com',
'Referer':'http://www.baidu.com',
'Cookie':'t=1766da7fa03df9fdb66af1ebaa160ecc;'}
conn = http.client.HTTPConnection('www.baidu.com')
conn.request('GET', '/', None, cHeader)
res = conn.getresponse()
print(res.status, res.reason)
print('-----------------')
print(res.msg)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
import urllib.request
cHeader = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv: