bkjones / pyrabbit

A Python module to communicate w/ the RabbitMQ HTTP Management API
http://pyrabbit.readthedocs.org
BSD 3-Clause "New" or "Revised" License
97 stars 86 forks source link

Problems with symbol "+" #16

Closed pchico closed 10 years ago

pchico commented 11 years ago

Hi, I found an issue when using the api method get_queue. It does not handle properly the symbol "+" and then, a query like get_queue("/", "a+b") fails. My workaround is to do: get_queue("/", re.sub(re.escape("+"), "%2B", "a+b")) which is not needed for other special symbols. Thanks!

bkjones commented 10 years ago

"+" is a reserved character and needs to be escaped in a URL. That said, I can certainly see that this makes for a suboptimal experience for developers who aren't in a mindset when using pyrabbit to expect that behavior. I'll check it out. Thanks for bringing it up.

bkjones commented 10 years ago

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm#whatwhy

bkjones commented 10 years ago

I've tested this and it's working in head. I'll be pushing a new version within the coming week.

>>> cl.get_queue('/', 'a+b')
URL: http://localhost:55672/api/queues/%2F/a%2Bb
{u'node': u'rabbit@localhost', u'auto_delete': False, u'deliveries': [], u'idle_since': u'2014-08-27 21:50:09', u'messages_unacknowledged': 0, u'consumers': 0, u'durable': True, u'arguments': {}, u'memory': 10956, u'exclusive_consumer_tag': u'', u'messages_ready_details': {u'rate': 0.0}, u'status': u'running', u'messages_details': {u'rate': 0.0}, u'vhost': u'/', u'consumer_details': [], u'messages_unacknowledged_details': {u'rate': 0.0}, u'incoming': [], u'name': u'a+b', u'policy': u'', u'backing_queue_status': {u'q1': 0, u'q3': 0, u'q2': 0, u'q4': 0, u'avg_ack_egress_rate': 0.0, u'ram_msg_count': 0, u'ram_ack_count': 0, u'len': 0, u'persistent_count': 0, u'target_ram_count': u'infinity', u'next_seq_id': 0, u'delta': [u'delta', u'undefined', 0, u'undefined'], u'pending_acks': 0, u'avg_ack_ingress_rate': 0.0, u'avg_egress_rate': 0.0, u'avg_ingress_rate': 0.0}, u'messages': 0, u'messages_ready': 0}