This article describes how to check the online status of QQ using Python. it is very simple and practical, and involves the skill of detecting the online status of QQ using a third-party platform, for more information about how to check the online status of QQ using Python, see the following example. 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.