Python3 RoboBrowser login for a WebSurvey Creator (WSC) page
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need to login to WSC page using RoboBrowser & python3. The logon form can be accessed here:
https://www.websurveycreator.com/login.aspx

Looking for a complete working example similar to non working example below:

import re
from robobrowser import RoboBrowser
rb = RoboBrowser(history=True)
rb.open('https://www.websurveycreator.com/login.aspx')
form=rb.get_form()
form['ctl00_BodyZone_lblEmailAddress1']="peter.pan@neverland.com"
form['ctl00_BodyZone_lblPassword']="tinker"
rb.submit_form(form)

src=str(rb.parsed())
print(src)

Thanks!

awarded to Codeword

Crowdsource coding tasks.

1 Solution

Winning solution

So, What are the current problems ? Also is it compulsory to use robobroser?

import re
from robobrowser import RoboBrowser

br = RoboBrowser(parser='html.parser')
res = br.open('https://www.websurveycreator.com/login.aspx')
form = br.get_form()
form['ctl00$BodyZone$txtEmailAddress'].value = 'peter.pan@neverland.com'
form['ctl00$BodyZone$txtPassword'].value = 'tinker
#form['ctl00$BodyZone$hiddenDBVersionCheck'].value = 'true'
#form['ctl00$BodyZone$cbRememberMe'].value = 'false'
br.submit_form(form)
print(form)
src = str(br.parsed())
print(src)

This fixes the bad request error but WE are missing some parameters we should pass so it's returning the login page instead as login fails.

Yes to RoboBrowser, the code generates the following exception: werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
broadreach 26 days ago
Please look at the code above.The bad request error was due to the fact you were using wrong key in form
Codeword 26 days ago
Works perfect. Thanks!
broadreach 26 days ago