Skip to content
Advertisement

Passing cookies while logging in

I would like to integrate python Selenium and Requests modules to authenticate on a website.

I am using the following code:

JavaScript

The problem is that when I enter the browser the login authentication is still there when I try to access the url even though I passed the cookies generated from the requests session.

How can I modify the code above to get through the authentication web page?

Advertisement

Answer

I finally found out what the problem was. Before making the post request with the requests library, I should have passed the cookies of the browser first. The code is as follows:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement