我正在尝试登录一个网站。我已将此代码从网站上获取
<form class="login-form">
<div class="form-group"><label for="email" class="text-input-label">Email<input id="email" type="email" name="email" required="" value=""></label></div>
<div class="form-group"><label for="password" class="text-input-label">Password<input id="password" type="password" name="password" required="" value=""></label></div>
<div class="remember-block">`enter code here`
<div class="checkbox-group checkbox-group__white"><input type="checkbox" id="rememberMe" name="rememberMe"><label class="checkbox-group__pseudo-checkbox" for="rememberMe"></label><label for="rememberMe" class="remember-label">Remember me</label></div>
<a class="reset-pass-link" href="/reset-password">Reset password</a>
</div>
<button class="btn btn-primary btn-rounded submit-btn">Login</button>
</form>
我已经写了这个来登录那个网站。但这会产生405错误。
import requests
# Fill in your details here to be posted to the login form.
payload = {
'email': 'xxxx',
'password': 'js@cen18'
}
login_url = 'https://app.uplead.com/login'
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
s.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36'
p = s.post(login_url, data=payload)
# print the html returned or something more intelligent to see if it's a successful login page.
print p.status_code
登录网站还需要哪些其他详细信息? 谢谢。