Skip to content

Commit

Permalink
update server-sae
Browse files Browse the repository at this point in the history
  • Loading branch information
atupal committed Jun 20, 2013
1 parent 8886266 commit d105a8e
Show file tree
Hide file tree
Showing 125 changed files with 17 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def index():
</html>
'''

#import logging
@app.route('/dianzan', methods = ['POST'])
def _dianzan():
if request.method != 'POST':
Expand All @@ -82,6 +83,8 @@ def _dianzan():
D = dianzan.Dianzan(qq = qq, pwd = pwd)
ret = D.dianzan(cnt = 5)
except Exception as e:
#logging.error(str(e))
print str(e)
ret = str(e)
ret += "<hr/>"
ret += "<p>%s</p>"%("用户名,密码错误,请再试一次")
Expand All @@ -105,6 +108,8 @@ def _dianzan_verify():
D.verify(data = data, headers = headers)
ret = D.dianzan()
except Exception as e:
#logging.error(str(e) + str(data))
print str(e) + str(data)
ret = str(e)
ret += "<hr/>"
ret += "<p>%s</p>"%("用户名,密码或者验证码错误!请再试一次")
Expand Down
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self, qq = None, pwd = None, feq = 1, inc = 5):
self.inc = inc
self.session = requests.Session()
self._login()
self.repeat_set = set()

def _parse(self, url, _xpath, content = None):
try:
Expand Down Expand Up @@ -190,9 +191,12 @@ def dianzan(self, cnt = 5, op = '1'):
urls = self._parse(None, '//*/@href', content = content)
for url in urls:
if url.content.find('like_action') != -1 and url.content[-1] == op:
if self.repeat_set.issuperset({url.content}):
continue
ret = self.session.get(url.content).content
if ret.find('成功') != -1:
print '赞成功'
self.repeat_set.add(url.content)

urls = self._parse(None, '//*[text()="更多好友动态>>" or text()="下页"]/@href', content = content)
for url in urls:
Expand Down Expand Up @@ -235,4 +239,11 @@ def verify(self, data, headers):
qq = raw_input('qq:')
pwd = raw_input('pwd:')
D = Dianzan(qq = qq, pwd = pwd)
D.dianzan()
import time
while 1:
try:
D.dianzan(cnt = 1)
except Exception as e:
print e
print '****'
time.sleep(300)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d105a8e

Please sign in to comment.