markmc/oslo-incubator — pull request #7 by FlaPer87 (2013-05-21 13:37:47+00:00)
Title: Add parse_url to _utils.

The patch adds parse_url to _utils as an attempt to find a common url
format that satisfies most drivers needs. The code isn't definitive but
instead the beginning for further discussions. Current code parses
transport urls like this:

qpid://test/test
{'exchange': 'test',
'hosts': [{'host': 'test', 'password': '', 'username': ''}],
'parameters': {},
'transport': 'qpid'}

qpid://test:port/test
{'exchange': 'test',
'hosts': [{'host': 'test:port', 'password': '', 'username': ''}],
'parameters': {},
'transport': 'qpid'}

qpid://username:password@test:port/test
{'exchange': 'test',
'hosts': [{'host': 'test:port',
'password': 'password',
'username': 'username'}],
'parameters': {},
'transport': 'qpid'}

qpid://username:password@test:port
{'exchange': None,
'hosts': [{'host': 'test:port',
'password': 'password',
'username': 'username'}],
'parameters': {},
'transport': 'qpid'}

qpid://username:password@test:port,test2:port2/test
{'exchange': 'test',
'hosts': [{'host': 'test:port',
'password': 'password',
'username': 'username'},
{'host': 'test2:port2',
'password': 'password',
'username': 'username'}],
'parameters': {},
'transport': 'qpid'}

qpid://username:password@test:port,:@test2:port2/test
{'exchange': 'test',
'hosts': [{'host': 'test:port',
'password': 'password',
'username': 'username'},
{'host': 'test2:port2', 'password': '', 'username': ''}],
'parameters': {},
'transport': 'qpid'}

qpid://username:password@test:port,:@test2:port2/test?option=value
{'exchange': 'test',
'hosts': [{'host': 'test:port',
'password': 'password',
'username': 'username'},
{'host': 'test2:port2', 'password': '', 'username': ''}],
'parameters': {'option': ['value']},
'transport': 'qpid'}