Ejemplo n.º 1
0
def main():
    # 打印Logo
    logo()
    ifContinue = True
    while ifContinue:
        model = Model()
        if model == '1':  #常规模式
            username = raw_input("Please input your username<<")
            password = raw_input("password<<")
            while (True):
                printf("Setting Browser...Please Wait", "purple")
                try:
                    browser = Login(username, password)
                except:
                    BaseException
                    print("Wrong password!")
                    username = raw_input("Please reinput your username<<")
                    password = raw_input("password<<")
                    continue

                printf("enter 0 to exit", "red")
                paperid = raw_input("Please input the ID of your paper<<")
                if paperid == '0':
                    break
                # 创建解答模块的实例
                #多线程2019.7.5
                try:
                    thread.start_new_thread(ModelOne, (browser, paperid))
                    printf("The Thread is Working ...")
                    time.sleep(1)
                except:
                    printf("Thread Error:unable to start thread", "red")

        if model == '2':
            printf("Warning ,this models is still in test!")
            username = raw_input("Please input your username<<")
            password = raw_input("password<<")
            browser = Login(username, password)
            while (True):
                papers = raw_input("How many papers do you want to Kill<<")
                for i in range(1, papers):
                    A = Answer()
                    A.GetAnswer(browser, i)
        if model == '3':
            printf("\n\tSettings is not available now!\n\n", 'blue')
        if model == '4':
            PrintInformation()
        if model == '5':
            ifContinue = False
            printf("Good Night!", "purple")
Ejemplo n.º 2
0
 def _run(self):
     Logger.info("启动主服务器成功")
     Logger.info("开始进行OPENLAW模拟登陆")
     cookies = Login()._run()
     Logger.info("模拟登陆完成,已经获取用户cookies")
     Logger.info("进入爬虫系统")
     Clawer(self, cookies)._run_master()
Ejemplo n.º 3
0
def GetUser():  # call back
    # 调用登陆模块
    username = entry1.get()
    password = entry2.get()
    print "Hello " + username + "!"
    printf("Setting Browser...Please Wait", "purple")

    try:
        browser = Login(username, password)
    except:
        BaseException
        print("Wrong password!")
Ejemplo n.º 4
0
def ModelOne(argc,argv):
    # 调用登陆模块
    username = entry1.get()
    password = entry2.get()
    print "Hello " + username + "!"
    printf("Setting Browser...Please Wait", "purple")

    try:
        browser = Login(username, password)
    except:
        BaseException
        print("Wrong password!")

    x = entry_paper.get()
    paperid = int(x)

    A = Answer()
    A.GetAnswer(browser, paperid)
Ejemplo n.º 5
0
 def _login(self):
     return Login().run()