mercredi 5 avril 2017

Logging in to website with requests module

I'm trying to get pass a login page but am having some trouble.

Below is what the webserver is looking for.

<form name="login" onsubmit="submitLoginInfo(); return false;" action="#" id="login"></form>

<input type="radio" name="username" value="Polycom" checked="checked">
<span class="radioLabel">Admin</span>
<input type="radio" name="username" value="User" class="radiogap">
<span class="radioLabel">User</span>

<input type="password" name="password" class="loginField" maxlength="32">

<input class="button gray medium" type="submit" value="Submit">

I have tried using the requests module with no luck. I'm assuming because there is no line for 'method = post' in the form

creds = {'password':'password'}
login = requests.post('http://ipaddress',data=creds)

login.content returns

b'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head><title>405 Method Not Allowed</title></head><body>\n</body></html>\n\n'

Thanks!




Aucun commentaire:

Enregistrer un commentaire