I want to login and scraping the site ‘https://ys.learnus.org’ but it connected to ‘https://www.learnus.org’. Is there a problem with SSO login?
# parser.py
import requests
from bs4 import BeautifulSoup
loginURL = 'https://ys.learnus.org/passni/sso/coursemosLogin.php'
requestURL = 'https://ys.learnus.org'
LOGIN_INFO = {
'ssoGubun': 'Login',
'logintype': 'sso',
'type': 'popup_login',
'username': 'ID',
'password': 'password!'
}
headers = {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9',
'Connection': 'keep-alive',
'Host': 's3.eu-central-1.amazonaws.com',
'Origin': 'https://www.fplanalytics.com',
'Referer': 'https://www.fplanalytics.com/',
'sec-ch-ua': '"Chromium";v="103", ".Not/A)Brand";v="99"',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36'
}
with requests.Session() as s:
loginPage = s.post(loginURL, data=LOGIN_INFO, verify=False, allow_redirects=False, headers = headers)
response = s.get(requestURL)
html = BeautifulSoup(response.content, 'html.parser')
print(html)
New contributor
user27470683 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3