网站大量收购独家精品文档,联系QQ:2885784924

09.获取好友列表(9 get a buddy list).doc

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
09.获取好友列表(9 get a buddy list) Author: tengge # #QQ:930372551 # this section, we will learn to get the friends list, by the way of learning Sid extraction # code some long, this is because the friend from a web page source code in the QQ number and the nickname of more trouble. This code also completes the login, access to Sid, access to online friends list three tasks! If you dont understand the dictionary and regular expressions, look at the previous tenggePy tutorial... Later, I will optimize and optimize... :) # this section of the code or the 3GQQ login code change, in front of the well! #6120c test successful Import httplib Import urllib Import re # regular expression module Def get_source (myurl, con={): }: get_source by tengge. Params = urllib.urlencode (CON) Headers = {Content-type:application/x-www-form-urlencoded,Accept:text/plain} Conn = httplib.HTTPConnection (72, 80) Conn.request (POST, myurl, params, headers) Data=conn.getresponse (),.Read (),.Replace (amp, ).Replace ( \n , # this change, will not use the character to remove, easy to handle Conn.close () Return data Print please enter your QQ number and press enter.Decode (utf8) Qq=raw_input () Print please enter your password and press enter.Decode (utf8) Pwd=raw_input () # gets a 3GQQ login page source code Data1=get_source (/s, aid=nLogin3gqqauto=1s_it=1g_f=286sid=gRx6/ZLbzPLJOMkXUX4bTA==) Mark=postfield name=, Sid, value= . Start=data1.find (mark) End=data1.find (/, start+1) Sid2=data1[start+len (mark): end] This is # to submit URLs and data Myurl= /handleLogin, r Con={Sid: sid2, QQ: str (QQ), PWD: PWD, toQQchat: true, modifySKey: 0, loginType: 1} # access login data Data2=get_source (myurl, con) ##### in front of several times ##### This time we only # will print out a successful login failure message, note that each utf8 encoding the Chinese characters accounted for three bytes Start=data2.find (login) Print data2[start:start+12].decode (utf8) # we find out the

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档