gmr / rabbitpy

A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
http://rabbitpy.readthedocs.org
BSD 3-Clause "New" or "Revised" License
242 stars 58 forks source link

Guest account name and credential are mandatory for rabbitpy since 0.27.x #96

Closed fizyk closed 7 years ago

fizyk commented 8 years ago

We're using rabbitpy as a pytest-dbfixtures rabbitmq client library of choice. And so far, our client fixtures defined the url as just:

amqp://host:port/%2F however, since 0.27.x, the url is parsed, and password unquoted even if it's no givem resulting in this error:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../virtualenv/python2.7.9/lib/python2.7/site-packages/rabbitpy/connection.py:101: in __init__
    self._args = self._process_url(url or self.DEFAULT_URL)
../../../virtualenv/python2.7.9/lib/python2.7/site-packages/rabbitpy/connection.py:487: in _process_url
    parsed = utils.urlparse(url)
../../../virtualenv/python2.7.9/lib/python2.7/site-packages/rabbitpy/utils.py:81: in urlparse
    _urlparse.unquote(parsed.username),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
s = None
    def unquote(s):
        """unquote('abc%20def') -> 'abc def'."""
        if _is_unicode(s):
            if '%' not in s:
                return s
            bits = _asciire.split(s)
            res = [bits[0]]
            append = res.append
            for i in range(1, len(bits), 2):
                append(unquote(str(bits[i])).decode('latin1'))
                append(bits[i + 1])
            return ''.join(res)

>       bits = s.split('%')
E       AttributeError: 'NoneType' object has no attribute 'split'
s          = None

Funny thing, that rabbitpy uses default password if it's not given in url, but that is being checked a bit after escaping here.