Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11428
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <1248283536@qq.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.137 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.75; '*S*': 0.02; 'subject:code': 0.07; 'skip:[ 20': 0.12; '<body>': 0.16; '<meta': 0.16; 'cookielib,': 0.16; 'file.close()': 0.16; 'skip:\xef 40': 0.16; 'subject:login': 0.16; 'to:name:python-list': 0.18; 'subject:not': 0.21; 'windows': 0.26; 'import': 0.28; 'subject:same': 0.30; "skip:' 10": 0.30; "can't": 0.33; 'to:addr:python-list': 0.33; 'skip:= 10': 0.34; 'skip:& 10': 0.34; 'skip:o 20': 0.38; 'header :Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'body': 0.61; 'virus:</script': 0.61; 'virus:<script': 0.61; '8bit%:100': 0.70; 'subject:one': 0.77; 'url:login': 0.77; 'subject:,': 0.81; '8bit%:54': 0.84; 'opener': 0.84; 'skip:& 80': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s0907; t=1313366993; bh=IlAqFVO81k0HZ7EVl/s/WhGLdETZem8UJhodGnKOruk=; h=X-QQ-SSF:X-QQ-BUSINESS-ORIGIN:X-Originating-IP:X-QQ-STYLE: X-QQ-mid:From:To:Subject:Mime-Version:Content-Type: Content-Transfer-Encoding:Date:X-Priority:Message-ID:X-QQ-MIME: X-Mailer:X-QQ-Mailer; b=jNeK3CEawyf3/gk9M0RWXW7jaTZxiEzIRAYhiTHDGkYUWgyTA5g7njgeSFXJdGLDn 2L7VcW6zOk6mBdxkgvEYZrmZGP1mb6wpPcyHBHB8MjUaICyKU4hbySo3U3LhQ/n |
| X-QQ-SSF | 00000000000000F0000000000000000 |
| X-QQ-BUSINESS-ORIGIN | 2 |
| X-Originating-IP | 113.116.46.110 |
| X-QQ-STYLE | |
| X-QQ-mid | webmail612t1313366992t3042273 |
| From | "守株待兔" <1248283536@qq.com> |
| To | "python-list" <python-list@python.org> |
| Subject | same code to login,one is ok,another is not |
| Mime-Version | 1.0 |
| Content-Type | multipart/alternative; boundary="----=_NextPart_4E4863D0_DF0A14B0_5FF4C73C" |
| Content-Transfer-Encoding | 8Bit |
| Date | Mon, 15 Aug 2011 08:09:52 +0800 |
| X-Priority | 3 |
| X-QQ-MIME | TCMime 1.0 by Tencent |
| X-Mailer | QQMail 2.x |
| X-QQ-Mailer | QQMail 2.x |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2292.1313367000.1164.python-list@python.org> (permalink) |
| Lines | 91 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1313367000 news.xs4all.nl 23904 [2001:888:2000:d::a6]:45405 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:11428 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
1.http://www.renren.com/Login.do
it is ok,my code:
import cookielib, urllib2, urllib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1; SV1)"),]
opener.addheaders=exheaders
url_login = 'http://www.renren.com/Login.do'
body = (('email',' '), ('password', '))
req1 = opener.open(url_login, urllib.urlencode(body))
file=open('/tmp/sample','w')
file.write(req1.read())
file.close()
2.https://passport.baidu.com/?login
can't login,my code:
import cookielib, urllib2, urllib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1; SV1)"),]
opener.addheaders=exheaders
url_login = 'https://passport.baidu.com/?login'
body =(('username',' '), ('password',' '),('pwd','1'))
req1 = opener.open(url_login, urllib.urlencode(body))
file=open('/tmp/sample','w')
file.write(req1.read())
file.close()
what i get is:
<!--STATUS OK-->
<html><head><title>������§�������� </title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<META http-equiv='Pragma' content='no-cache'>
</head>
<body>
<script>
var url="./?pwd=1"
url=url.replace(/^\.\//gi,"http://passport.baidu.com/");
location.href=url;
</script>
</body>
</html>
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
same code to login,one is ok,another is not "守株待兔" <1248283536@qq.com> - 2011-08-15 08:09 +0800 Re: same code to login,one is ok,another is not Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-15 10:55 +1000
csiph-web