[英]How can I __scrape__ a password protected website using beautifulsoap and python?
https://khaiexch.com/ How can i scrape this website. https://khaiexch.com/我怎样才能抓取这个网站。 I am trying something like this but it is giving 403 as response
我正在尝试这样的事情,但它给出了 403 作为响应
login_url = 'https://khaiexch.com/login/login_action'
login_data = {
"email": "***",
"password": "****",
"compute": "****",
"submitted": "****"
}
r = requests.post(login_url, data=login_data)
But the above code is giviing me 403 error, Can any one please guide me how can I scrape this website?但是上面的代码给了我403错误,谁能指导我如何抓取这个网站?
Try requesting with get
method and use headers aswell that would be something like this:尝试使用
get
方法请求并使用标头,这将是这样的:
import requests
login_url = 'https://khaiexch.com/login/login_action'
login_data = {
"email": "***",
"password": "****",
"compute": "****",
"submitted": "****"
}
headers = {'User-Agent': 'okhttp/3.12.1'}
r = requests.get(login_url, data=login_data, headers=headers)
result = r.status_code
print (result)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.