diff options
author | makefu <github@syntax-fehler.de> | 2013-09-02 19:28:00 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2013-09-02 19:28:00 +0200 |
commit | 34d684f27da3500db837d56628fe82e03359278c (patch) | |
tree | f3e933aa835f547b5ef31930d907111d98a2b73a /util/bin | |
parent | 655ff5e0ec72e4ad021964e6c5d3e8087fe01e6f (diff) |
add urlparse
Diffstat (limited to 'util/bin')
-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) |