Skip to content

Instantly share code, notes, and snippets.

@digulla
Created August 29, 2013 12:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digulla/6377563 to your computer and use it in GitHub Desktop.
Save digulla/6377563 to your computer and use it in GitHub Desktop.
Command line utility to test and debug proxy.pac files. Depends on https://code.google.com/p/pacparser/
#!/usr/bin/env python2
# Usage: $0 proxy.pac url
import pacparser
import sys
import urlparse
pacfile, url = sys.argv[1:]
pacparser.init()
pacparser.parse_pac_file(pacfile)
url = urlparse.urlparse(url)
site = '%s://%s' % (url.scheme, url.netloc)
print 'Proxy for %s is %s' % (site, pacparser.find_proxy(site, url.netloc))
pacparser.cleanup()
@tuxpeople
Copy link

You should add "Depends on https://code.google.com/p/pacparser/" to the comments in the script

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