diff options
Diffstat (limited to 'util/bin/urlparse')
-rwxr-xr-x | util/bin/urlparse | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/util/bin/urlparse b/util/bin/urlparse index f536bafa..3767b929 100755 --- a/util/bin/urlparse +++ b/util/bin/urlparse @@ -1,24 +1,23 @@ #!/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 - from sys import argv,exit return urlparse(uri) if __name__ == "__main__": - try: - uri=argv[1] + uri = argv[1] except: print('usage: %s URI') exit(1) - for k,v in uri_parser(uri): - print('USERNAME='% u.username) - print('PASSWORD='% u.password) - print('HOST="%s"'% u.password) - print('PATH="%s"'% u.path) + u = uri_parser(uri) + print('USERNAME="%s"' % u.username) + print('PASSWORD="%s"' % u.password) + print('HOSTNAME="%s"' % u.hostname) + print('URIPATH="%s"' % u.path) |