I'm trying to use the requests module to log in to a website. I'm not sure what to reference in the html form to post the username and password. Here is the form I'm trying to use to post with to log in:
<div class="login-box contents" id="login">
<!--<div class="login-instruction">
<label class="fl-label"> Enter your information below to login. </label>
</div>-->
<div class="login-username">
<label for="username" class="fl-label">Username: </label>
<div class="clearboth"></div>
<input id="proxyUsername" name="proxyUsername" class="required" tabindex="1" maxLength="100" type="text" value="" onChange="remove_Error()" autocomplete="off"/>
</div>
<div class="float-right">
<b><input type="checkbox" id="proxyRememberUser" name="proxyRememberUser" tabindex="-1" value="checked"> Remember Username</input></b>
</div>
<br/>
<div class="login-password">
<label for="password" class="fl-label">Password: </label>
<div class="clearboth"></div>
<input id="proxyPassword" name="proxyPassword" class="required" tabindex="2" maxLength="50" type="password" value="" onChange="remove_Error()" autocomplete="off" />
</div>
I'm trying to figure out where/how in the form I tell it to put the username and password. So in the code below, the keys for the payload_login variable are not correct:
import requests
username = raw_input('Please enter your username: ')
password = raw_input('Please enter your password: ')
payload_login = {
'Username': username,
'Password': password
}
with requests.Session() as s:
con = s.post('somewebsite.com', \
data=payload_login)