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

documentation error: httplib2.ServerNotFoundError: Unable to find the server at http #56

Open justinc1 opened 6 years ago

justinc1 commented 6 years ago

I believe in docs/index.rst line

cl = Client('http://localhost:55672/api', 'guest', 'guest')

should be

cl = Client('localhost:55672', 'guest', 'guest')

While copying example code, I first got:

root@2b2e772eeff1:/code# ./sender-http.py 
http://http:/rabbitmq:15672/api/api/exchanges/myvh/amq.default/publish
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/httplib2/__init__.py", line 1187, in _conn_request
    conn.connect()
  File "/usr/local/lib/python3.6/dist-packages/httplib2/__init__.py", line 918, in connect
    for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyrabbit/http.py", line 106, in do_call
    headers)
  File "/usr/local/lib/python3.6/dist-packages/httplib2/__init__.py", line 1514, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/local/lib/python3.6/dist-packages/httplib2/__init__.py", line 1264, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/local/lib/python3.6/dist-packages/httplib2/__init__.py", line 1194, in _conn_request
    raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at http

And string http://http:/rabbitmq:15672/api/api/exchanges/myvh/amq.default/publish has obvious errors.

TTPerotti commented 3 years ago

Thank you for this, it saved my evening! This certainly has been open a while. I wonder if it will get merged.

norkos commented 1 year ago

thank you ! :)