From 4f8ac29f0ca730d48212282605cd61c654a42529 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 2 Sep 2013 19:34:59 +0200 Subject: urlparse ->uriparse --- util/bin/uriparse | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 util/bin/uriparse (limited to 'util/bin/uriparse') diff --git a/util/bin/uriparse b/util/bin/uriparse new file mode 100755 index 00000000..685b1ab1 --- /dev/null +++ b/util/bin/uriparse @@ -0,0 +1,28 @@ +#!/usr/bin/python +import os +from sys import argv,exit + +def uri_parser(uri): + try: + from urlparse import urlparse + except: + from urllib.parse import urlparse + + return urlparse(uri) + +if __name__ == "__main__": + try: + uri = argv[1] + except: + print('usage: %s URI') + exit(1) + u = uri_parser(uri) + + print('SCHEME="%s"' % u.scheme) + if u.username: + print('USERNAME="%s"' % u.username) + if u.password: + print('PASSWORD="%s"' % u.password) + if u.path: + print('URIPATH="%s"' % u.path) + print('HOSTNAME="%s"' % u.hostname) -- cgit v1.2.3