使用python检测手机QQ在线状态的脚本代码

WBOY
Release: 2016-06-16 08:46:52
Original
1163 people have browsed it
复制代码 代码如下:

import time,datetime   
import urllib2  
def chk_qq(qqnum):
    chkurl = 'http://wpa.qq.com/pa?p=1:'+`qqnum`+':1'
    a = urllib2.urlopen(chkurl)   
    length=a.headers.get("content-length")   
    a.close()   
    print datetime.datetime.now()   
    if length=='2329':   
        return 'Online'  
    elif length=='2262':   
        return 'Offline'  
    else:   
        return 'Unknown Status!' 
qq = 12345678
stat = chk_qq(qq)   
print `qq` + ' is ' + stat
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!