Skip to content

Instantly share code, notes, and snippets.

@sleeptillseven
Created December 20, 2011 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sleeptillseven/1501267 to your computer and use it in GitHub Desktop.
Save sleeptillseven/1501267 to your computer and use it in GitHub Desktop.
Install Sublime Package Control
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({'http': 'http://myproxy.com:8080'}))); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
@sleeptillseven
Copy link
Author

In case you have no idea where to put your proxy parameters. It took me a few minutes, as I myself am not a Pythonian. Enjoy!

@wbond
Copy link

wbond commented Dec 20, 2011

The default command (with urllib2.ProxyHandler() being called with no params) should pull in your system-wide proxy settings. You should only need to do this (according to the Python docs) if you need to use a different proxy, or your proxy is not configured system-wide.

I think on Windows the system-wide proxy is pulled via IE settings. On Linux I believe it is through the HTTP_PROXY env var. I'm not sure how it works on OS X.

@sleeptillseven
Copy link
Author

Yeah, unfortunately on Windows (in an enterprise or for me at least) it doesn't work. So I provided some hints. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment