0
Website requests
Im trying to use requests to login to a website, i know how to access the html, but i cant find out how to get to the website after Here is the html code for the log in boxes: <form id="main-login-form" class="login-form form-container"> <input name="username" id="username-input" placeholder="Username" class="form-input" autofocus> <input name="password" type="password" placeholder="Password" class="form-input"> <div class="clearfix"> <div class="form-status"> <div class="form-loading hidden-opacity">Signing in...</div> <div class="form-error hidden-opacity"></div> </div> <div class="form-button-container"> <button class="form-button">Log In</button>
1 Antwort
0
I have my setup as follows
from bs4 import BeautifulSoup
import requests
user="usre"
passw="pass"
D={"Username":user,"Password":passw}
loginsite="https://focus.pcsb.org/focus/index.php"
securedsite="https://focus.pcsb.org/focus/Modules.php?modname=misc/Portal.php"
with requests.session() as s:
s.post(loginsite,data=D)
page=s.get(securedsite)
soup=BeautifulSoup(page.content,"html.parser")
print(soup)
but it returns the data as if it were the first page