Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import zlib
- BEFORE = '''\
- G-Method:GET
- G-Url:https://plus.google.com/u/0/
- User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1470.0 Safari/537.36
- Referer:https://www.google.com/
- Cookie:PREF=ID=c466dedd9499308f:U=4d6ba2ae810e18e8:FF=0:LD=zh-CN:NW=1:CR=2:
- Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
- Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4
- Accept-Encoding:gzip,deflate,sdch
- Host:plus.google.com
- Connection:close
- '''
- AFTER = '''\
- G-Method:GET
- G-Url:https://plus.google.com/u/0/
- User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1470.0 Safari/537.36
- Referer:http://www.google.com/
- Cookie:PREF=ID=c466dedd9499308f:U=4d6ba2ae810e18e8:FF=0:LD=zh-CN:NW=1:CR=2:
- G-Abbv:AL,AE,A
- '''
- deflate = lambda x:zlib.compress(x)[2:-4]
- rate = lambda a,b: '%g%%' % round(100.0*abs(a-b)/max(a,b), 2)
- print 'uncompressed rate:', (len(B), len(A), rate(len(B), len(A)))
- print 'compressed rate:', (len(deflate(B)), len(deflate(A)), rate(len(deflate(B)),len(deflate(A))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement