Reputation: 53031
I know it's possible to open up specific URL's with python's webbrowser module. Is it possible to use strings as search queries with it, or another module? Say in an engine like Google or Yahoo?
Upvotes: 0
Views: 1024
Reputation:
If you want to search with webbrowser, and allows user to input, this code might helps you.
import webbrowser
question = input("Input your question:")
webbrowser.open("https://www.google.com/search?q=" + str(question))
Upvotes: 0
Reputation: 90852
Of course it's possible - they're just GET requests. So long as you format the URL properly with the query string correct and all (http://google.com/search?q=query
- look at the site to see what it needs to be), it'll work fine. It's just a URL.
Upvotes: 1
Reputation: 34718
You might want to look at mechanise if you want to automate webpages. You could also generate your own search url and then call it in webbrowser or urllib See: http://www.our-picks.com/archives/2007/01/30/google-search-urls-revealed-or-how-to-create-your-own-search-url/
Upvotes: 0