From 96e199d8c8354e7138828b097e8bfc58d67e8fe8 Mon Sep 17 00:00:00 2001 From: mzcyx <920082975@qq.com> Date: Fri, 23 Dec 2016 12:44:29 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hostloc/hostloc.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/hostloc/hostloc.py b/hostloc/hostloc.py index 1ebcbea..971b865 100644 --- a/hostloc/hostloc.py +++ b/hostloc/hostloc.py @@ -2,9 +2,11 @@ import requests import re import cookielib +import sys index='http://www.hostloc.com/' page_url='http://www.hostloc.com/forum-45-1.html' +credit_url='http://www.hostloc.com/home.php?mod=spacecp&ac=credit&showcredit=1' login_url='http://www.hostloc.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1' login_data={ 'fastloginfield':'username' @@ -23,7 +25,8 @@ ,'Upgrade-Insecure-Requests':'1' ,'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36' } - + + class HostLoc(): def __init__(self,username,passwd): self.username=username @@ -55,6 +58,18 @@ def isLogin(self): return False else: return True + + def get_credit(self): + html=self.session.get(credit_url).content + credit_pattern=re.compile(r'