Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

tuxpeople commented Sep 11, 2013

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