Automate logging in to MS form using Python

0 votes

I have to login into the same Microsoft Form everyday to fill out and I know I wont remeber do due this, so I'm trying to automate it. Problem with this is that MS Forms has no API for filling out forms and I have to login with my MS account.

Currently my code looks like this. From what I can tell it logins, but gets stuck at a redirect page between the login and the form. (I know password is not secured. I'm still looking into that.)

session = requests.Session()

login_data = {
    'login': EMAIL,
    'passwd': PASSWORD,
    'submit': 'login',
}
form_content = ''
with session as c:
    c.post( LOGIN_URL, data = login_data )
    form_content = c.get( FORM_URL )

From what I can tell this works for login, but if I have a browser on my computer logged in to microsoft it will give me a connection error. If It succeeds to login and I try to access the MS Form, it sends me to a redirect page (see image below) where I'm stuck. Any ideas on how to procced or if there is a better way of doing this?

I have downloaded the MS form page as an HTML file if that can help.

ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

Apr 22, 2022 in Python by Edureka
• 13,620 points
1,469 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

+1 vote
1 answer

How to create plots using python matplotlib in IPython notebook?

I think you should try: I used %matplotlib inline in ...READ MORE

answered Aug 8, 2018 in Python by Priyaj
• 58,020 points
1,576 views
0 votes
1 answer

Shortest path from source to and from a negative cycle using Bellman Ford in Python

class NegativeWeightFinder: def __init__(self, graph: nx.Graph): ...READ MORE

answered Nov 13, 2018 in Python by Nymeria
• 3,560 points
1,327 views
0 votes
4 answers

How to print objects of class using print function in Python?

>>> class Test: ... ...READ MORE

answered Dec 16, 2020 in Python by Roshni
• 10,480 points
78,511 views
0 votes
1 answer

How to correctly return an a dictionary as an output in zappier code using python?

David here, from the Zapier Platform team. ...READ MORE

answered Dec 3, 2018 in Python by charlie_brown
• 7,720 points
1,648 views
0 votes
1 answer

How to check latest change time of each file using glob in python?

You can get the changing time from ...READ MORE

answered Jan 2, 2019 in Python by Omkar
• 69,220 points
1,558 views
0 votes
1 answer

Crawling after login in Python

You missed a few login data forms, ...READ MORE

answered Sep 7, 2018 in Python by Priyaj
• 58,020 points
1,676 views
0 votes
1 answer

Crawling after login in Python

You missed a few login data forms, ...READ MORE

answered Sep 14, 2018 in Python by Priyaj
• 58,020 points
853 views
0 votes
1 answer

“stub” __objclass__ in a Python class how to implement it?

You want to avoid interfering with this ...READ MORE

answered Sep 27, 2018 in Python by Priyaj
• 58,020 points
2,350 views
+1 vote
1 answer

How is raw_input() and input() in python3.x?

raw_input() was renamed to input() so now input() returns the exact string ...READ MORE

answered Oct 30, 2018 in Python by Priyaj
• 58,020 points
897 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP