summaryrefslogtreecommitdiffstats
path: root/util/bin/urlparse
blob: f536bafa017ee3e710c9a7f9c0d84a7a6305d444 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)