- 论坛徽章:
- 0
|
# -*- coding: cp936 -*-
import urllib,httplib,re,string,time
ip = open('ip.txt','r').read()
sid=open('sid.txt','r')
for line in sid.readlines():
line=line.rstrip()
#line='3gqq'+line
print line
try:
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
conn = httplib.HTTPConnection(ip)
k=urllib.urlencode({"aid":"nqqchatMain",
"on":"1"})
conn.request("POST", "http://q32.3g.qq.com/g/s?"+line, k, headers)
print conn.getresponse().read().decode('utf-8')
lin='3gqq'+line
k=urllib.urlencode({"aid":"nLogin3gqqbysid"})
conn.request("POST", "http://pt5.3g.qq.com/s?"+lin, k, headers)
print conn.getresponse().read().decode('utf-8')
except:
print 'pass'
------------------------------------------------------------------
-------------------------------------------------------------------
代码作用:每次读取文本中的一行加入到URL 访问这个URL
怎么实现多线程呢? |
|