项目需要刷屏做测试, 用python写的小玩意,主要是编译以后方便分发。象blogjava这种限制了ip的就不能刷了。
# A little tool to refresh the web page, try it
# ghostdog@gmail.com
import urllib
import optparse
print "for help: httpr -v"
p = optparse.OptionParser()
p.add_option('--verbose', '-v', action='store_true')
p.add_option('--url', '-u', default='http://localhost:7000/?id=402882cf11c1ee000111c1f2552f0003')
p.add_option('--number', '-n', default="1000",type="int")
options, arguments = p.parse_args( )
if options.verbose:
print "Usuage: httpr -u yourPageUrl -n repeatNumber "
SystemExit
if options.url: print "refresh " + options.url,
print '%s!' % options.number
url = options.url
if len(url) <7 :
print "bad rerquest url. it's too short ! "
SystemExit
if url.lower().startswith("http://") == False : url = "http://" + url
count = 0
while count < options.number:
f = urllib.urlopen(url)
count += 1
print "request ", count
print "refresh has done, it's %s times" % options.number
SystemExit
python做小工具挺好的,就是俺太菜。