Python模拟http get,python模拟get,import sys,
文章由Byrx.net分享于2019-03-23 05:03:23
Python模拟http get,python模拟get,import sys,
import sys, urllib2, urllibdef addGETdata(url, data): '''Adds data to url. Data should be a list or tuple consisting of 2-item lists or tuples of the form: (key, value). Items that have no key should have key set to None. A given key may occur more than once. ''' return url + '?' + urllib.urlencode(data)zipcode = 'S2S 7U8'url = addGETdata('http://www.wunderground.com/cgi-bin/findweather/getForecast', [('query', zipcode)])print 'Using URL', urlreq = urllib2.Request(url)fd = urllib2.urlopen(req)while 1: data = fd.read(1024) if not len(data): break sys.stdout.write(data)
相关内容
- python的get set方法示例,pythongetset示例,class Critte
- Python布隆过滤器实现代码,python布隆过滤器,之前用py
- Python list根据下标删除元素,pythonlist,python list的
- 登陆邮箱 爬取邮件,登陆邮箱邮件,import urlli
- 移动Web APP开发之实战美团外卖,app外卖,如需下述哪一
- python字典读取语言文件=号后的内容合并.py,python.py,"
- wifi 掉线自动重连,wifi掉线,#!/usr/bin/e
- python多线程多队列(BeautifulSoup网络爬虫),,程序大概
- 用Python多线程抓取并验证代理,python多线程抓取,因为工
- range()、xrange()函数实现,rangexrange,# -*- coding
评论关闭