pyrabbit icon indicating copy to clipboard operation
pyrabbit copied to clipboard

Printing api URL disturbs target application

Open xhujerr opened this issue 10 years ago • 9 comments

Method HTTPClient.do_call() (http.py, line 101) unconditionally echoes url. I use pyrabbit in an agent which catches and parses stdout. Echoed url causes error since is unexpected by the agent.

I see two possible solutions:

  1. The url is a debug message and thus it shall be removed.
  2. The url printing is useful somehow. Then the client class shall have option silent=False. If set to true, the url won't be echoed.

xhujerr avatar Mar 04 '15 10:03 xhujerr

Ok. Now I see there are already several merge requests for this bug. The least intrusive from jofusa.

Can you merge that please?

xhujerr avatar Mar 04 '15 10:03 xhujerr

+1, please :)

stephane-martin avatar Mar 15 '15 23:03 stephane-martin

+1

ricardoklein avatar Aug 16 '16 18:08 ricardoklein

+1

Rajlaxmi avatar Aug 26 '16 10:08 Rajlaxmi

+1

rnt avatar Sep 10 '16 16:09 rnt

Hi I'm still having this issue with the latest pip install of pyrabbit (1.1.0). Everytime I use the client it prints the url, when I use "pip install -U git+https://github.com/bkjones/pyrabbit.git" it removes this issue but I then get;

Traceback (most recent call last): File "messages.py", line 13, in all_queue_names = [str(q['name']) for q in cl.get_queues()] File "/home/anaconda2/lib/python2.7/site-packages/pyrabbit/api.py", line 478, in get_queues queues = self._call(path, 'GET') File "/home/anaconda2/lib/python2.7/site-packages/pyrabbit/api.py", line 108, in _call resp = self.http.do_call(path, method, body, headers) File "/home/anaconda2/lib/python2.7/site-packages/pyrabbit/http.py", line 102, in do_call raise HTTPError(content, resp.status_code, resp.text, path, body) pyrabbit.http.HTTPError: 404 - Not found. (None) (queues) (None)

This appear when trying to run a very basic code ?

from pyrabbit.api import Client

cl = Client('localhost:15672', 'guest', 'guest') all_queue_names = [str(q['name']) for q in cl.get_queues()]

any help would be greatly appreciated

sclooney94 avatar Oct 04 '16 11:10 sclooney94

+1

This is fixed in master but not latest v1.1.0 release https://github.com/bkjones/pyrabbit/blob/v1.1.0/pyrabbit/http.py#L101

I'm redirecting stdout to /dev/null as a workaround >/dev/null

morganchristiansson avatar Apr 13 '17 10:04 morganchristiansson

+1

ShibaBandit avatar Jun 23 '17 21:06 ShibaBandit

I fork and update module. Welcome https://github.com/deslum/pyrabbit2

deslum avatar Jul 24 '17 18:07 deslum