亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 請(qǐng)問(wèn)下面的python腳本是什么意思? [打印本頁(yè)]

作者: luojiakun    時(shí)間: 2011-09-23 18:38
標(biāo)題: 請(qǐng)問(wèn)下面的python腳本是什么意思?
#!/usr/bin/python

import os
import sys
import time
import locale
import httplib

def usage(prog_name):
        print '''Usage: %s website username times
                        website: 163 or sina or poco or sinaweibo or weiboqq or weibo163''' %prog_name

def test163(username,times):
        headers= {}
        headers["Accept"] = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-icq, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
        headers["Referer"] = "http://reg.163.com/login.jsp"
        headers["Accept-Language"] ="zh-cn"
        headers["Accept-Encoding"] = "gzip, deflate"
        headers["Content-Type"]= "application/x-www-form-urlencoded"
        headers["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; QQDownload 551; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1)"
        headers["Connection"] = "Keep-Alive"
        headers["Cache-Control"] = "no-cache"
        headers["Cookie"] = "URSJESSIONID=aFf5hPMy_Psc"
        for i in range(0, times):
                user = str(username) + " " + str(i)
                data = "rl=&type=1&product=&savelogin=&outfoxer=&domains=&username=" + user + "@163.com&password=" + user + "&Submit="
                conn = httplib.HTTPConnection("reg.163.com")
                conn.request("POST",  "/logins.jsp", data, headers)
                r = conn.getresponse()
                print r.read()
                conn.close()
                time.sleep(1)
上面的腳本是何意思,開(kāi)頭的headers= {}代表什么?
作者: BangBull    時(shí)間: 2011-09-23 18:41
HTTP Header
作者: ubuntu_mark    時(shí)間: 2011-09-24 08:48
定義一個(gè)字典,然后賦值,模擬登錄頁(yè)面
作者: luojiakun    時(shí)間: 2011-09-27 09:55
回復(fù) 3# ubuntu_mark


    謝謝




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2