def GetGroupNameList(self, vfwebqq): try: url = "http://s.web2.qq.com/api/get_group_name_list_mask2" #postdata="r=%7B%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" #postdata=postdata.replace("{$vfwebqq}",vfwebqq) hash = newhash(self.QQ, self.ptwebqq) r = { "hash": hash, "vfwebqq": vfwebqq, } r = json.dumps(r) data = { "r": r, } postdata = urllib.urlencode(data) postdata = postdata.replace("+", "") ret = self.Post(url, postdata, QQRobot.HOST[1], QQRobot.REFERER[1], QQRobot.ORIGIN[1]) print 'Step5: GetGroupList' self.SendMsg('Step5: GetGroupList') retjson = json.loads(ret) retjson = retjson["result"] self.grouplist = retjson for group in self.grouplist['gnamelist']: print group["code"], group["name"] msgrecord = str(group["code"]) + " " + group["name"] self.SendMsg(msgrecord.encode("utf8")) except Exception, e: print "GetGroupNameList error" + str(e)
def GetGroupNameList(self,vfwebqq): try: url="http://s.web2.qq.com/api/get_group_name_list_mask2" #postdata="r=%7B%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" #postdata=postdata.replace("{$vfwebqq}",vfwebqq) hash=newhash(self.QQ, self.ptwebqq) r={ "hash":hash, "vfwebqq":vfwebqq, } r=json.dumps(r) data = { "r":r, } postdata=urllib.urlencode(data) postdata=postdata.replace("+","") ret=self.Post(url,postdata,QQRobot.HOST[1],QQRobot.REFERER[1],QQRobot.ORIGIN[1]) print 'Step5: GetGroupList' self.SendMsg('Step5: GetGroupList') retjson=json.loads(ret) retjson=retjson["result"] self.grouplist=retjson for group in self.grouplist['gnamelist']: print group["code"],group["name"] msgrecord=str(group["code"])+" "+group["name"] self.SendMsg(msgrecord.encode("utf8")) except Exception,e: print "GetGroupNameList error"+str(e)
def GetFriendList(self): hash = newhash(self.QQ, self.ptwebqq) url = "http://s.web2.qq.com/api/get_user_friends2" postdata = "r=%7B%22h%22%3A%22hello%22%2C%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$ptwebqq}%22%7D" postdata = postdata.replace("{$hash}", hash) postdata = postdata.replace("{$ptwebqq}", self.ptwebqq) ret = self.Post(url, postdata, QQRobot.HOST[1], QQRobot.REFERER[1], QQRobot.ORIGIN[1]) retjson = json.loads(ret) retjson = retjson["result"] self.friends = retjson #有备注名的好友 marknames = retjson["marknames"] #无备注名的好友 info = retjson["info"] for m in marknames: try: print m["uin"], m["markname"] except: print "the marknames name is wrong" for i in info: try: print i["uin"], i["nick"] except: print "the info name is wrong"
def GetGroupNameList(self,vfwebqq): try: hash=newhash(self.QQ, self.ptwebqq) url="http://s.web2.qq.com/api/get_group_name_list_mask2" #postdata="r=%7B%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" postdata="r=%7B%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" postdata=postdata.replace("{$vfwebqq}",vfwebqq) postdata=postdata.replace("{$hash}",hash) ret=self.Post(url,postdata,QQRobot.HOST[1],QQRobot.REFERER[1],QQRobot.ORIGIN[1]) print 'Step5: GetGroupList' retjson=json.loads(ret) retjson=retjson["result"] self.grouplist=retjson for group in self.grouplist['gnamelist']: print group["code"],group["name"] except Exception,e: print "GetGroupNameList error"+str(e)
def GetGroupNameList(self, vfwebqq): try: hash = newhash(self.QQ, self.ptwebqq) url = "http://s.web2.qq.com/api/get_group_name_list_mask2" #postdata="r=%7B%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" postdata = "r=%7B%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" postdata = postdata.replace("{$vfwebqq}", vfwebqq) postdata = postdata.replace("{$hash}", hash) ret = self.Post(url, postdata, QQRobot.HOST[1], QQRobot.REFERER[1], QQRobot.ORIGIN[1]) print 'Step5: GetGroupList' retjson = json.loads(ret) retjson = retjson["result"] self.grouplist = retjson for group in self.grouplist['gnamelist']: print group["code"], group["name"] except Exception, e: print "GetGroupNameList error" + str(e)
def GetFriendList(self): hash=newhash(self.QQ, self.ptwebqq) url="http://s.web2.qq.com/api/get_user_friends2" #postdata="r=%7B%22h%22%3A%22hello%22%2C%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" #postdata=postdata.replace("{$hash}",hash) #postdata=postdata.replace("{$vfwebqq}",self._sucessdata["vfwebqq"]) r={ "h":"hello", "hash":hash, "vfwebqq":self._sucessdata["vfwebqq"], } r=json.dumps(r) data = { "r":r, } postdata=urllib.urlencode(data) postdata=postdata.replace("+","") ret=self.Post(url,postdata,QQRobot.HOST[1],QQRobot.REFERER[1],QQRobot.ORIGIN[1]) retjson=json.loads(ret) retjson=retjson["result"] self.friends=retjson #有备注名的好友 marknames=retjson["marknames"] #无备注名的好友 info=retjson["info"] for m in marknames: try: print m["uin"],m["markname"] msgrecord=str(m["uin"])+" "+m["markname"] self.SendMsg(msgrecord.encode("utf8")) except: print "the marknames name is wrong" for i in info: try: print i["uin"],i["nick"] msgrecord=str(i["uin"])+" "+i["nick"] self.SendMsg(msgrecord.encode("utf8")) except: print "the info name is wrong"
def GetFriendList(self): hash = newhash(self.QQ, self.ptwebqq) url = "http://s.web2.qq.com/api/get_user_friends2" #postdata="r=%7B%22h%22%3A%22hello%22%2C%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$vfwebqq}%22%7D" #postdata=postdata.replace("{$hash}",hash) #postdata=postdata.replace("{$vfwebqq}",self._sucessdata["vfwebqq"]) r = { "h": "hello", "hash": hash, "vfwebqq": self._sucessdata["vfwebqq"], } r = json.dumps(r) data = { "r": r, } postdata = urllib.urlencode(data) postdata = postdata.replace("+", "") ret = self.Post(url, postdata, QQRobot.HOST[1], QQRobot.REFERER[1], QQRobot.ORIGIN[1]) retjson = json.loads(ret) retjson = retjson["result"] self.friends = retjson #有备注名的好友 marknames = retjson["marknames"] #无备注名的好友 info = retjson["info"] for m in marknames: try: print m["uin"], m["markname"] msgrecord = str(m["uin"]) + " " + m["markname"] self.SendMsg(msgrecord.encode("utf8")) except: print "the marknames name is wrong" for i in info: try: print i["uin"], i["nick"] msgrecord = str(i["uin"]) + " " + i["nick"] self.SendMsg(msgrecord.encode("utf8")) except: print "the info name is wrong"
def GetFriendList(self): hash=newhash(self.QQ, self.ptwebqq) url="http://s.web2.qq.com/api/get_user_friends2" postdata="r=%7B%22h%22%3A%22hello%22%2C%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$ptwebqq}%22%7D" postdata=postdata.replace("{$hash}",hash) postdata=postdata.replace("{$ptwebqq}",self.ptwebqq) ret=self.Post(url,postdata,QQRobot.HOST[1],QQRobot.REFERER[1],QQRobot.ORIGIN[1]) retjson=json.loads(ret) retjson=retjson["result"] self.friends=retjson #有备注名的好友 marknames=retjson["marknames"] #无备注名的好友 info=retjson["info"] for m in marknames: try: print m["uin"],m["markname"] except: print "the marknames name is wrong" for i in info: try: print i["uin"],i["nick"] except: print "the info name is wrong"