diff options
author | makefu <github@syntax-fehler.de> | 2013-09-02 18:40:35 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2013-09-02 18:40:35 +0200 |
commit | 655ff5e0ec72e4ad021964e6c5d3e8087fe01e6f (patch) | |
tree | 9553f6075a5686644ffefa284bb59a1c8e4a97a2 /util/bin/urlparse | |
parent | 98686d061bd4b3c106a092983fa47463c623a4aa (diff) |
util/bin/urlparse: make executable
Diffstat (limited to 'util/bin/urlparse')
-rwxr-xr-x | util/bin/urlparse | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/util/bin/urlparse b/util/bin/urlparse new file mode 100755 index 00000000..f536bafa --- /dev/null +++ b/util/bin/urlparse @@ -0,0 +1,24 @@ +#!/usr/bin/python +import os + +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] + 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) |