Advertisement
n8henrie

Dynamic Search Bookmark with Pythonista

Nov 4th, 2013
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. import webbrowser
  4. import console
  5. import sys
  6. import urllib
  7.  
  8. search = console.input_alert('Search term?')
  9. search = urllib.quote_plus(search)
  10.  
  11. safari_prefix = ''
  12. if sys.platform != 'darwin':
  13.     safari_prefix = 'safari-'
  14.        
  15. url = safari_prefix + 'http://google.com/search?q={0}+site:n8henrie.com'.format(search)
  16.  
  17. webbrowser.open(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement