i'm beginner in Python so how a good ways to get url from any browser like chrome, opera, etc to variable in Python ? thanks
3 Answers
To answer this, you need to understand what context you are trying to grab the URL in for your Python app.
Are you making a desktop app that runs in the background and tracks Browser HTTP requests for different URLS? Windows (assuming you use it) already has something that already does that. Open command prompt and type in ipconfig /displaydns > dnslist.txt -- Viola! :)
Are you making trying to run Python code inside your web browser to do this? Browsers don't support Python normally but if you wanted you could install a plugin and ask your users to install it. You can read more about that here: Chrome extension in python? In this case I would strongly reccomend you just use Javascript however. The plugin just converts your python into JS anyway since browsers are made to only execute Javascript by default...
Are you trying to make a serverside app? In this case you would always know what domain is being called because it would be the domain of your own website! Your webserver would always know the exact URL that was requesting it in this case.
Which is it for you?
3 Comments
ipconfig /displaydns > dnslist.txt Source: superuser.com/questions/52181/… Much easier than writing a whole new app ;)