Python checks the online status of QQ and python checks the online status.
This article describes how to check the online status of QQ using Python. Share it with you for your reference. The specific implementation method is as follows:
Import time, datetime import urllib2 def chk_qq (qqnum): chkurl = 'HTTP: // wpa.paipai.com/pa? P = 1: '+ 'qqnum' +': 17'a = urllib2.urlopen (chkurl) length =. headers. get ("content-length"). close () print datetime. datetime. now () print length if length = '000000': return 'line' elif length = '000000': return 'offline' else: return 'unknown Status! 'Def writestate (statenow): f = open (str (qq), 'A') m = str (datetime. datetime. now () + "= state =" + statenow + "\ n \ r" f. write (m) f. close () qq = 847893543 # state = 1if _ name __= = '_ main _': while 1: stat = chk_qq (qq) writestate (stat) time. sleep (6000) # print 'qq' + 'is' + stat once every 5 minutes
I hope this article will help you with Python programming.