#!/usr/bin/env python
#coding:utf8
import datetime
import urllib2

'''
  checkurl = http://wpa.paipai.com/pa?p=1:123456:17
'''


def chk_qq(qqnum):
    chkurl = 'http://wpa.paipai.com/pa?p=1:' + str(qqnum) + ':17'
    a = urllib2.urlopen(chkurl)
    length = a.headers.get("content-length")
    a.close()
    print datetime.datetime.now()
    print length
    if length == '2348':
        return 'Online'
    elif length == '2205':
        return 'Offline'
    elif length == '2343':
        return 'leave'
    else:
        return 'Unknown Status!'


qq = "123456"

if __name__ == '__main__':
    print chk_qq(qq)


运行时将123456替换成查询的qq即可,不过如果是手机在线,检测不出来。