当前位置: 首页>>代码示例>>Python>>正文


Python Login类代码示例

本文整理汇总了Python中Login的典型用法代码示例。如果您正苦于以下问题:Python Login类的具体用法?Python Login怎么用?Python Login使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Login类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Crawler

def Crawler(number, weibo_url):
    Login.login()  #首先进行模拟登录
    fp4 = open("chinese_weibo.txt","w+")  #初始化写入文件
    for n in range(number):
        n = n + 1
        url = 'http://weibo.com/' + weibo_url + '?is_search=0&visible=0&is_tag=0&profile_ftype=1&page=' + str(n)
        # url = 'http://s.weibo.com/weibo/%s&Refer=index'%weibo_url
        print U"爬取URL:",url
        content = Getraw_HTML.get_rawHTML(url)  # 调用获取网页源文件的函数执行
        print u"获取第 %d  成功 , 并写入到 raw_html.txt"%n
        Gettext_CH.Handel(content, fp4)         # 调用解析页面的函数
        print u"获取第 %d 微博内容成功, 并写入到 chinese_weibo.txt"%n
        #time.sleep(1)
    fp4.close()
    ########## 数据爬取完毕!
    # 对爬取到的微博进行去重处理
    fp = open('chinese_weibo.txt', 'r')
    contents = []
    for content in fp.readlines():
        content = content.strip()
        contents.append(content)
    fp.close()
    set_contents = list(set(contents))
    set_contents.sort(key=contents.index)
    fp_handel = open('chinese_weibo.txt', 'w+')
    for content in set_contents:
        fp_handel.write(content)
        fp_handel.write('\n')
    fp_handel.close()
开发者ID:xiangxiaobaog3,项目名称:project,代码行数:29,代码来源:multi_crawler.py

示例2: getMessage

def getMessage(msgidx, readStamp=True):
	""" 쪽지를 읽어온다 """
	
	mData = Archive("MsgInBox").getValues(msgidx, "Content,Receiver,Sender,Attachments,IsRead")
	
	if mData == None:
		raise SpartaUserError("존재하지 않는 쪽지번호 입니다")
	
	if mData["Receiver"] != Login.getID() and mData["Sender"] != Login.getID():
		raise SpartaUserError("메세지를 볼수있는 권한이 없습니다")
	
	if readStamp and (mData["IsRead"] == False):
		# 스탬핑 처리
		Archive("MsgInBox").Edit(msgidx, IsRead=True)
		
		# 보낸 편지에도 읽기 스템핑
		r_idx = Archive("MsgSent").getValue("MsgSent.RelateIDX == "+str(msgidx), "IDX")
		if r_idx:
			Archive("MsgSent").Edit(r_idx, IsRead=True)			   
	
	outText = mData["Content"]
	
	if mData["Attachments"]:		
		outText += u'<table class="filedownBox"><tr><td>첨부</td><td><a href="/getfile/message/%s">%s</a></td></tr></table>' % ( msgidx, mData["Attachments"])
	
	return outText
开发者ID:onetera,项目名称:sp,代码行数:26,代码来源:Message.py

示例3: removeMessage

def removeMessage(msgidx):
	
	mData = Archive("MsgInBox").getValues(msgidx, "Receiver,Sender,Attachments")
	
	if mData == None:
		raise SpartaUserError("존재하지 않는 쪽지번호 입니다")
	
	if mData["Receiver"] != Login.getID() and (not CheckAdmin()) and mData["Sender"] != Login.getID():
		raise SpartaAccessError("메세지를 삭제할 수 있는 권한이 없습니다")
	
	r = Archive("MsgInBox").Remove( msgidx )
	#[TODO] 파일삭제 처리!!!	
	return r
开发者ID:onetera,项目名称:sp,代码行数:13,代码来源:Message.py

示例4: setUp

 def setUp(self):
     global login_cookie
     login_cookie = None
     login_cookie = Login.login()
     if [] in login_cookie:
         raise AssertionError("Login is not successful.")
     else:
         print "Login is done successfully."
开发者ID:poonam-zymr,项目名称:Poonam_scripts,代码行数:8,代码来源:test_create_config.py

示例5: testLogin

 def testLogin(self):
     br=Login.login(self.driver,self.baseurl)
     log=ResultLog.resultLog()
     time.sleep(10)
     result=br.find_element_by_css_selector("a.red").is_displayed()
     print result
     if result:
         log.info("用户已登录2")
     else:
         log.info(u"用户登录失败")
开发者ID:Hardworking-tester,项目名称:autotest,代码行数:10,代码来源:LoginMethod.py

示例6: sendMessage

def sendMessage( receiver, subject, content, attachments=None, withSMS=None ):
	""" 쪽지함에 쪽지를 발송	
	"""
	#[TODO] To,CC,BCC에 대한 처리 필요 
	#[TODO] IF not logined !!
	
	smsList = []
	msgIDXs = []
	msgSave = { "Subject": subject, "Content": content, "Sender": Login.getID(), "SenderName": Login.getName() }
   
	if "<" in receiver:
		#ex) Address Parsing :: "정기영" <[email protected]>, "김태희" <[email protected]>  -> ["[email protected]",  "[email protected]"]
		addrsList = re.findall("\<([._,a-zA-Z0-9:\#\@]+)\>+", receiver)
	else:	 
		addrsList = [n.strip() for n in receiver.split(",")]
	
	for recID in addrsList:
		
		userData = Archive("User").getValues( "User.UserID == "+ recID, "Name,HandPhone" )
		if userData:
			msgSave["Receiver"] = recID
			
			result_IDX = Archive("MsgInBox").New(**msgSave)
			
			if result_IDX:
				msgIDXs.append( result_IDX )
				if userData["HandPhone"] and not userData["HandPhone"].replace("-","") in smsList:
					smsList.append( str(userData["HandPhone"].replace("-","")) )
				
				sentMsg = { "RelateIDX": result_IDX, "Subject": subject, "Content": content, "Receiver": recID, "ReceiverName": userData["Name"], "Sender": Login.getID() } 
				r = Archive("MsgSent").New( **sentMsg )
	
	if attachments:
		#[TODO] 임시 코드입니다. 멀티센딩에서 업된 파일에 대한 레퍼런스 카운트가 이상적이나 일단 그냥 복제형태로 갑니다.
		if type(attachments) == unicode:
			attachments = attachments.encode("utf8")
		
		uploadFile = Files.getRootDir() + attachments
		fileName = os.path.split(attachments)[1]
		
		if os.path.exists( uploadFile ):
			for ridx in msgIDXs:
				if str(ridx).isdigit():
					targetFile = "/data/message/%s.%s" % ( fileName, ridx )
					shutil.copy2( uploadFile, Files.getSpartaDir() + targetFile )
					msgMod = { "IDX" : ridx, "Attachments" : "%s" % fileName }
					r = Archive( "MsgInBox" ).New( **msgMod )
			os.remove(uploadFile)
	
	if withSMS and smsList:		   
		SMS.send( sendMsg=u"스팔타쪽지>"+msgSave["Subject"], recvList=smsList )
	
	return len(msgIDXs)
开发者ID:onetera,项目名称:sp,代码行数:53,代码来源:Message.py

示例7: OnInit

    def OnInit(self):
        ftp = FTPClient()
        login = Login()
        explorer = Explorer()
        
        start = login.ShowModal()

        if start == wx.ID_OK:
            login.disable()
            
            ftp.setHostname(login.getHostname())
            ftp.setUsername(login.getUsername())
            ftp.setPassword(login.getPassword())
                       
            ftp.connect()
            ftp.login()
            
            explorer.setFTP(ftp)
            explorer.Show()
            
            login.Destroy()
        else:
            return False
            
        return True
开发者ID:jasonjohnson,项目名称:theftpclient,代码行数:25,代码来源:Application.py

示例8: getActiveProjects

def getActiveProjects():
	
	accLevel = Login.getLevel()
	
	#[TIP] 프로젝트는 Active 된 것들만 보여짐  
	RDB = Archive("Project").Search(columns="Project.IDX,Project.Code,Project.Name", 
									 where="Project.StatCode == ACT", 
									 order="Project.SortNumber ASC", 
									 accfield="Project.AccessView", acclevel=accLevel)
	outData = []
	for row in RDB[1]:			  
		outData.append( (row["Project_IDX"], row["Project_Code"], row["Project_Name"]) )
	
	return outData
开发者ID:onetera,项目名称:sp,代码行数:14,代码来源:Project.py

示例9: test_add_load

    def test_add_load(self):
        """QQ登录测试"""
        width = self.driver.get_window_size()['width']
        height = self.driver.get_window_size()['height']

        Login.login(self)
        sleep(4)
        self.driver.find_element_by_android_uiautomator('new UiSelector().description("帐户及设置")').click()
        sleep(1)
        self.driver.find_element_by_android_uiautomator('new UiSelector().description("设置")').click()
        sleep(2)
        self.driver.find_element_by_xpath('//android.widget.TextView[contains(@text, "帐号管理")]').click()
        self.driver.swipe(width / 2, height / 2, width / 2, height / 4, 1000)
        self.driver.find_element_by_name("退出当前帐号").click()
        self.driver.find_element_by_xpath('//android.widget.TextView[contains(@text, "确认退出")]').click()

        try:

            sleep(2)
            self.driver.swipe(width / 2, height / 2, 114, height / 2, 1000)
            sleep(2)
        except Exception as e:
            print(e)
开发者ID:Mayor1991,项目名称:qqtest5,代码行数:23,代码来源:test_qqtest.py

示例10: menu

def menu(host, T, t_host):
	while True:
		print ("Scegli azione PEER:\nlogin\t - Login\nquit\t - Quit\n\n")
		choice = input()

		if (choice == "login" or choice == "l"):
			t_host, sessionID = logi.login(host, t_host)
			if sessionID != bytes(const.ERROR_LOG, "ascii"):
				tfunc.success("Session ID: " + str(sessionID, "ascii"))

				listPartOwned = {}

				daemonThreadP = daemon.PeerDaemon(host, listPartOwned)
				daemonThreadP.setName("DAEMON PEER")
				daemonThreadP.setDaemon(True)
				daemonThreadP.start()

				waitingDownload = []

				while True:
					if len(waitingDownload) == 0:
						print ("\n\nScegli azione PEER LOGGATO:\nadd\t - Add File\nsearch\t - Search and Download\nlogout\t - Logout\n\n")
						choice_after_log = input()

						if (choice_after_log == "add" or choice_after_log == "a"):
							add.add(host, sessionID, t_host, listPartOwned)

						elif (choice_after_log == "search" or choice_after_log == "s"):
							src.search(sessionID, host, t_host, listPartOwned, waitingDownload)

						elif (choice_after_log == "logout" or choice_after_log == "l"):
							if (logo.logout(host, t_host, sessionID) > 0):

								break

						else:
							tfunc.error("Wrong Choice!")
					else:
						time.sleep(1)

			else:
				tfunc.error("Errore Login")	

		elif (choice == "quit" or choice == "q"):
			if T:
				logo.quit(host)
			break

		else:
			tfunc.error("Wrong Choice")
开发者ID:tommasoberlose,项目名称:p2p_bittorrent,代码行数:50,代码来源:Menu.py

示例11: FixPath

def FixPath(uncPath):
	# Temp function 
	# \\rfsv01\~~
	# //rfsv01
	# smb://
	
	brName = Login.getBrowserName()
	osType = Login.getOSType()						  
	
	if (osType == "posix"):
		uncPath = uncPath.replace("\\", "/")			
		if uncPath.startswith("file://"): 
			uncPath = uncPath[7:]				 
		if not uncPath.startswith("sparta://"): 
			if uncPath.startswith("\\\\") or uncPath.startswith("//"):
				uncPath = uncPath[2:].replace("//","/")
			uncPath = "sparta://"+uncPath
	
	elif (osType == "nt"):
		# 웹 경로			  
		if uncPath[0] == "/" and uncPath[1] != "/":
			return uncPath
			 
		if uncPath.startswith("smb://"): 
			uncPath = uncPath[6:]
		if uncPath.startswith("file://"): 
			uncPath = uncPath[7:]
				
		uncPath = uncPath.replace("/", "\\")
		 
		if brName == "MSIE":
			if not uncPath.startswith("\\\\"):
				uncPath = "\\\\" + uncPath
		else:
			uncPath = "file://" + uncPath
	   
	return uncPath
开发者ID:onetera,项目名称:sp,代码行数:37,代码来源:Convert.py

示例12: removeMessage

def removeMessage(msgidx):
	
	msg_receiver_q = Session.query(MsgReceiver).filter_by(idx = msgidx).first()
	
	if None == msg_receiver_q:
		raise SpartaUserError("존재하지 않는 쪽지입니다")

	# 로그인한 사용자가 메시지를 받은 사용자가 아닌 경우 삭제할 수 없다는 메시지를 출력하게 한다.
	if msg_receiver_q.ReceiverID != Login.getID() and (not CheckAdmin()):
		raise SpartaAccessError("메시지를 삭제할 수 있는 권한이 없습니다")

	msg_receiver_q.IsDelete = u"1"

	Session.commit()

	# 항상 1을 반환한다.
	return 1
开发者ID:onetera,项目名称:sp,代码行数:17,代码来源:nMessage.py

示例13: setPassword

def setPassword( userid, newpassword):
	
	if userid != Login.getID() and (not CheckAdmin()):
		raise SpartaAccessError("패스워드를 변경할수 있는 권한이 없습니다.")
		
	useridx = getIDX( userid )
	
	if useridx:
		hashedPass = hashlib.md5( newpassword ).hexdigest()    
		r = 0 < Archive("User").Edit( useridx, Password=hashedPass )
		
	else:
		raise SpartaError("[버그] 아이디의 IDX 정보가 잘못되었습니다.")
	
	if r:
		return True
	else:
		raise SpartaError("패스워드를 수정하지 못했습니다.")
开发者ID:onetera,项目名称:sp,代码行数:18,代码来源:User.py

示例14: check

def check(bot, update):
    print(users)
    if UP_States.get(str(update.message.chat_id) , -1) == REGISTERED:
            try:   
                login = Login.login(users[str(update.message.chat_id)])
                print (str(update.message.from_user.first_name) + '  =>  Check')
                login.encryptUserPassword()
                login.logIn()
                html = login.html                
                scpr = Scrapper.scrapper(html)
                scpr.make()
                bot.sendMessage(update.message.chat_id, text=scpr.text)
                print (str(update.message.from_user.first_name) + '  =>  Succecfull')
            except BaseException as ex :
                print (ex.args);
                bot.sendMessage(update.message.chat_id, text="An error has occured")
    else:
        bot.sendMessage(update.message.chat_id, text="Please set up username and password at first.")   
开发者ID:heftekharm,项目名称:goly_bot,代码行数:18,代码来源:Bot.py

示例15: cancelMessage

def cancelMessage(sentidx):
	
	mData = Archive("MsgSent").getValues(msgidx, "RelateIDX,Sender,Attachments")
	
	if mData == None:
		raise SpartaUserError("존재하지 않는 쪽지번호 입니다")
	
	if mData["Sender"] != Login.getID() and (not CheckAdmin()):
		raise SpartaUserError("메세지를 삭제할 수 있는 권한이 없습니다") 
	
	rData = Archive("MsgInBox").getValue( mData["RelateIDX"], "IDX,IsRead")
	
	if rData:
		if rData["IsRead"] == False:
			return removeMessage( rData["IDX"] )
		else:
			raise SpartaUserError("발송된 메세지는 이미 읽은 메세지입니다")
	else:
		raise SpartaUserError("발송된 메세지는 이미 삭제되었습니다")
	
	return int(0)
开发者ID:onetera,项目名称:sp,代码行数:21,代码来源:nMessage.py


注:本文中的Login类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。