コード例 #1
0
 def sale(self):
     theStartPage = self.itemStart.get()
     theEndPage = self.itemEnd.get()
     WhatPosition = self.number.get()
     try:
         showinfo(title='状态', message='点击开始下载')
         a = load.go(WhatPosition, theStartPage, theEndPage)
         if a == 'ok':
             whentime = time.strftime('%Y-%m-%d %H:%M:%S',
                                      time.localtime(time.time()))
             try:
                 db.conn(WhatPosition, whentime)
             except:
                 showinfo(title='错误', message='数据库错误')
             showinfo(title='状态', message='下载完成')
             self.root.destroy()
             root = Tk()
             root.title('小程序')
             # AnalysisG(root,'C:\\Users\\Dell\\Desktop\\爬虫代码\\php.xlsx')
             root.mainloop()
         else:
             showinfo(title='错误',
                      message='您使用次数过多,ip暂时被停封,不用担心,换个ip或者等待一段时间就可以')
     except:
         showinfo(title='错误', message='请正确输入起始页与终止页')
コード例 #2
0
 def technology(self):
     theStartPage = self.itemStart.get()
     theEndPage = self.itemEnd.get()
     WhatPosition = self.number.get()
     try:
         showinfo(title='状态', message='点击开始下载')
         filename = os.path.abspath('') + '\\' + WhatPosition + '.xlsx'
         a = load.go(WhatPosition, theStartPage, theEndPage)
         if a == 'ok':
             whentime = time.strftime('%Y-%m-%d %H:%M:%S',
                                      time.localtime(time.time()))
             try:
                 db.conn(WhatPosition, whentime)
             except:
                 showinfo(title='错误', message='数据库错误')
             showinfo(title='状态', message='下载完成')
             self.root.destroy()
             root = Tk()
             root.title('小程序')
             AnalysisG(root, filename)
             root.mainloop()
         else:
             showinfo(title='错误',
                      message='您使用次数过多,ip暂时被停封,不用担心,换个ip或者等待一段时间就可以')
     except:
         showinfo(title='错误', message='请正确输入起始页与终止页')