I am a newbie in python, and I have to retrieve the data of this page. http://mims.com/india/drug/search?q=dextro but as this website requires user login so I went through the following code.
import requests
from bs4 import BeautifulSoup as bs
POST_LOGIN_URL = "https://sso.mims.com/Account/Signin"
REQUEST_URL = "https://mims.com/india/drug/search?q=DEXTRO%20PLUS"
payload = {
"EmailAddress": "email address here",
"Password" : "password here"
}
with requests.Session() as session:
post = session.post(POST_LOGIN_URL, data=payload)
r = session.get(REQUEST_URL)
with open('abc.html', 'wb')as f:
f.write(r.content)
Instead of showing the desired result, it is redirecting me to a page and I am getting a "FORM" element which contains method="post" request and a button which autoclicks. So I am unable to figure it out please someone help.
Solved it using and after login or any other request. 解决了该问题,并在登录或任何其他请求后 。
So that background request completes it's execution and return to the required page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.