<h2 class="block-title">
<img class="img img-16 img-grey-down"
src="https://sstatic.fotolia.com/v2010/pics/all/img/clear.gif"
alt="arrow" />
I already have an account
<span class="block-title-right"></span>
</h2>
<div class="block-content">
<p>Welcome back!</p>
<form action="/Member/Login" method="post">
<div class="form login-form mini-form">
<div class="form-line on">
<label class="form-label" for="login">
Login <span class="form-required">*</span>
</label>
<input type="text" name="login" id="login" value="" class="form-text" tabindex="1" />
<div class="cb"></div>
</div>
<div class="form-line">
<label class="form-label" for="password">
Password <span class="form-required">*</span>
</label>
<input type="password" name="password" id="password" value="" class="form-text" tabindex="2" />
<div class="cb"></div>
</div>
<div class="form-line remember-form-line on">
<a class="form-lost" href="http://www.fotolia.com/Member/ForgotPassword">
Forgot password?
</a>
<label class="form-label" for="remember_me">
<input type="checkbox" name="remember_me" id="remember_me" value="1" class="form-checkbox" tabindex="3" />
Remember me
</label>
<div class="cb"></div>
</div>
<div class="form-action">
<input type="submit" name="signin" id="signin" value="Login " class="button button-S-L color-1-button" tabindex="4" />
<div class="cb"></div>
</div>
</div>
</form>
</div>
你好!我正在尝试发布变量登录凭据,但不幸的是,它没有给我登录后页面(我们在成功登录后获得的页面),目前代码是这样的:
import os
import httplib, urllib
import urllib import urllib2
def file_write(filename, text_to_write):
f = open(filename, 'w')
f.write(text_to_write)
f.close()
if __name__ == "__main__":
url = 'https://www.fotolia.com/Member/Login'
user_agent ='Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
values = {
'login': 'XXXXXXXXXXX',
'password': 'Random123',
}
headers = {'User-Agent': "some-user-agent"}
data = urllib.urlencode(values)
req = urllib2.Request(url, data, headers)
response = urllib2.urlopen(req)
the_page = response.read()
file_write('output.html', the_page)
问题:
处理页面没有文件扩展名,让我们看看这里的表单动作写成 /Member/Login ?并且协议是 HTTPS,我应该如何处理这种情况。