'opening a web browser and get url histories in python

I am trying to make a python gui application.

What I want to do is to open a web browser by clicking a button. (Tkinter) When the web browser is opened, I do login. After logging it, it will redirect to the page. And that page url will consist of code as a param I need to use later in code.

I used webbrowser.open_new('') to open a web browser. But the limitation was it is only for opening.. there was no way to get the final redirected url I need.

Is there a way I can use to open a web browser and do something on that page and finally get that final url?

I am using python.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source