コード例 #1
0
ファイル: LoginDialog.py プロジェクト: adodo1/baiducloud
    def after_login(self, data, error):
        xml, errdict = data
        if errdict['err_no'] == 257:  #Need verification Code
            codestring = errdict['codeString']
            url = 'https://passport.baidu.com/cgi-bin/genimage?' + codestring

            vd = VcodeDialog(self, url)
            vd.run()
            vf = vd.get_user_input()
            if not vf or len(vf) != 4:
                self.info_label.set_text(
                    "Verification Code missing or incorrect!")
                return
            else:
                vd.destory()
            utils.async_call(auth.relogin,
                             rsakey,
                             pubkey,
                             self.username,
                             self.password,
                             vf,
                             codeString,
                             callback=self.after_login)

        elif errdict['err_no'] == 0:
            self.info_label.set_text("Login Successfully!")
            self.hide()
        self.spinn.destroy()
コード例 #2
0
 def on_search_button_clicked(self, button):
     print("Click", button)
     url = 'http://pan.baidu.com/genimage?33324238656332346361663334656637323237633636373637643239666664336662343932343631383931303030303030303030303030303031343335353131313938D9224DC2E75F22A923706D077C0CD5B2'
     vd = VcodeDialog(self, url)
     response = vd.run()
     print(response)
     if response == 22:
         print("The OK button was clicked")
         vcode = vd.get_user_input()
         vd.destroy()
     elif response == Gtk.ResponseType.DELETE_EVENT:
         vd.destroy()
コード例 #3
0
ファイル: MajorWindow.py プロジェクト: xiviwo/baiducloud
	def on_search_button_clicked(self,button):
		print("Click",button)
		url = 'http://pan.baidu.com/genimage?33324238656332346361663334656637323237633636373637643239666664336662343932343631383931303030303030303030303030303031343335353131313938D9224DC2E75F22A923706D077C0CD5B2'
		vd = VcodeDialog(self,url)
		response = vd.run()
		print(response)
		if response == 22:
			print("The OK button was clicked")
			vcode = vd.get_user_input()
			vd.destroy()
		elif  response == Gtk.ResponseType.DELETE_EVENT:
			vd.destroy()
コード例 #4
0
ファイル: LoginDialog.py プロジェクト: xiviwo/baiducloud
	def after_login(self,data,error):
		xml,errdict = data
		if errdict['err_no']  == 257 : #Need verification Code
			codestring = errdict['codeString'] 
			url = 'https://passport.baidu.com/cgi-bin/genimage?' + codestring
			
			vd = VcodeDialog(self,url)
			vd.run()
			vf = vd.get_user_input()
			if not vf or len(vf) != 4:
				self.info_label.set_text("Verification Code missing or incorrect!")
				return
			else:
				vd.destory()
			utils.async_call(auth.relogin,rsakey,pubkey,self.username,self.password,vf,codeString,
							 callback=self.after_login)

		elif errdict['err_no']  == 0: 
			self.info_label.set_text("Login Successfully!")
			self.hide()
		self.spinn.destroy()
コード例 #5
0
ファイル: cloudapi.py プロジェクト: xiviwo/baiducloud
def add_task(bdstoken,t_url,save_path,dia):
	header = {
	'Content-Type':'application/x-www-form-urlencoded',
	'Host':PAN_HOST,
	'Referer':DISK_HOME,
	}
	url = CLOUD_DL + '?bdstoken=' + bdstoken + '&channel=chunlei&clienttype=0&web=1'
	post = {
	'method':'add_task',
	'app_id':'250528',
	'source_url':t_url,
	'save_path':save_path,
	'type':'3',
	}
	xml = fetch(url,post,utils.myname(),header,save_path)
	j = json.loads(xml.decode("utf-8"))
	logger.debug("json: %s "% str(j))
	
	if 'error_code' in list(j.keys()):
		logger.info(j['error_msg'])
		if j['error_code'] != 36022 :
			while 'vcode' in list(j.keys()):
				vcode = j['vcode']
				logger.info(vcode)
				imgurl = j['img']
				#f=open(vimg,"wb")
				#fp = fetch(imgurl,{},"Input Vcode")
				#f.write(fp)
				#f.close()
				#try:
				#	subprocess.Popen(['xdg-open', vimg])
				#except:
				#	print("please open file %s to check the vcode."%vimg)
				#mag = re.search('(&.*$)',t_url).group(1)
				#task_name = dict(urllib.parse.parse_qsl(mag))['dn']

				#logger.info("Please input vcode for task: %s ."%(task_name))
				vd = VcodeDialog(dia,imgurl)
				vd.new_url(imgurl)
				response = vd.run()
				print(response)
				if response == 22:
					print("The OK button was clicked")
					vf = vd.get_user_input()
					vd.destroy()
				elif  response == Gtk.ResponseType.DELETE_EVENT:
					vd.destroy()
				#input("verification code # ").strip()
				
				add = {
				'file_sha1':'',
				'selected_idx':'1,2,3,4',
				'task_from':'0',
				't':utils.tt(),
				'type':4,
				'input':vf,
				'vcode':vcode,
				}
				print(add)
				post.update(add)
				xml = fetch(url,post,"TryWithVcode",header,save_path)
				j = json.loads(xml.decode("utf-8"))
				logger.debug("json: %s "% str(j))
				if 'error_code' in list(j.keys()):
					logger.info(j['error_msg'])
			return j
		else:
			
			return j['error_msg']
	logger.debug("json: %s "% str(j))

	return j
コード例 #6
0
ファイル: cloudapi.py プロジェクト: adodo1/baiducloud
def add_task(bdstoken, t_url, save_path, dia):
    header = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Host': PAN_HOST,
        'Referer': DISK_HOME,
    }
    url = CLOUD_DL + '?bdstoken=' + bdstoken + '&channel=chunlei&clienttype=0&web=1'
    post = {
        'method': 'add_task',
        'app_id': '250528',
        'source_url': t_url,
        'save_path': save_path,
        'type': '3',
    }
    xml = fetch(url, post, utils.myname(), header, save_path)
    j = json.loads(xml.decode("utf-8"))
    logger.debug("json: %s " % str(j))

    if 'error_code' in list(j.keys()):
        logger.info(j['error_msg'])
        if j['error_code'] != 36022:
            while 'vcode' in list(j.keys()):
                vcode = j['vcode']
                logger.info(vcode)
                imgurl = j['img']
                #f=open(vimg,"wb")
                #fp = fetch(imgurl,{},"Input Vcode")
                #f.write(fp)
                #f.close()
                #try:
                #	subprocess.Popen(['xdg-open', vimg])
                #except:
                #	print("please open file %s to check the vcode."%vimg)
                #mag = re.search('(&.*$)',t_url).group(1)
                #task_name = dict(urllib.parse.parse_qsl(mag))['dn']

                #logger.info("Please input vcode for task: %s ."%(task_name))
                vd = VcodeDialog(dia, imgurl)
                vd.new_url(imgurl)
                response = vd.run()
                print(response)
                if response == 22:
                    print("The OK button was clicked")
                    vf = vd.get_user_input()
                    vd.destroy()
                elif response == Gtk.ResponseType.DELETE_EVENT:
                    vd.destroy()
                #input("verification code # ").strip()

                add = {
                    'file_sha1': '',
                    'selected_idx': '1,2,3,4',
                    'task_from': '0',
                    't': utils.tt(),
                    'type': 4,
                    'input': vf,
                    'vcode': vcode,
                }
                print(add)
                post.update(add)
                xml = fetch(url, post, "TryWithVcode", header, save_path)
                j = json.loads(xml.decode("utf-8"))
                logger.debug("json: %s " % str(j))
                if 'error_code' in list(j.keys()):
                    logger.info(j['error_msg'])
            return j
        else:

            return j['error_msg']
    logger.debug("json: %s " % str(j))

    return j