#!/usr/bin/env python3
#
# Prints the proxy returned by GProxy for a given URL
# Michael Gratton <mike@vee.net>
#

import sys
from gi.repository import Gio

def main():
    if len(sys.argv) <= 1:
        print('Usage: {} URI'.format(sys.argv[0]), file=sys.stderr)
        sys.exit(1)

    uri = sys.argv[1]
    resolver = Gio.ProxyResolver.get_default()
    proxies = resolver.lookup(uri, None)

    for proxy in proxies:
        print(proxy)

if __name__ == '__main__':
    main()

