mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.25k stars 190 forks source link

Can't connect. #157

Closed mawaishanif closed 6 years ago

mawaishanif commented 6 years ago

`Traceback (most recent call last): File "<pyshell#8>", line 1, in asyncio.run(acon()) File "C:\Users\Awais\AppData\Local\Programs\Python\Python37\lib\asyncio\runners.py", line 43, in run return loop.run_until_complete(main) File "C:\Users\Awais\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 568, in run_until_complete return future.result() File "<pyshell#5>", line 2, in acon return await aio_pika.connect("AMPQ URL") File "C:\Users\Awais\AppData\Local\Programs\Python\Python37\lib\site-packages\aio_pika\connection.py", line 437, in connect await connection.connect() File "C:\Users\Awais\AppData\Local\Programs\Python\Python37\lib\site-packages\aio_pika\connection.py", line 232, in connect result = await f ConnectionRefusedError: Connection to 35.183.159.128:5672 failed: timeout

`

Here is my function async def acon(): return await aio_pika.connect("URL")

I have changed url and ip to dummy ones.

I can connect to locally hosted rabbitMQ server but when I connect to external server I see this error.

mosquito commented 6 years ago

You pass an invalid URL I guess. Pass the connection URL in this format:

amqp://{username}:{password}@{host}:{port}/{vhost}

mosquito commented 6 years ago

As I can see you have 35.183.159.128 on Amazon Cloud. Did you check the firewall settings?

mawaishanif commented 6 years ago

"amqp://username:passwordB@host/vhost"

I am using this format and my username and vhost are same. But there is missing port.

Let me try the format you have given me. And thanks for quick response.

URL is dummy one but I am on Amazon Cloud.

mawaishanif commented 6 years ago

I am still getting the same error, here is the actual URL "amqp://wvekznkq:password@mustang.rmq.cloudamqp.com/wvekznkq"

mosquito commented 6 years ago

Could you try to connect using telnet 35.183.159.128 5672?

mawaishanif commented 6 years ago

I am not getting any error after I try it. I get blank screen with cursor I think it got connected.

This is actual IP "5.189.189.198 5672"

mosquito commented 6 years ago

You should see something like this

# telnet 5.189.189.198 5672
Trying 5.189.189.198...
Connected to 5.189.189.198.

the last string Connected to 5.189.189.198. indicates succesfull TCP connection.

mawaishanif commented 6 years ago

Maybe something is wrong with cmd promopt/powershell in windows. It does not give any response. But the blank screen I get after typing this cmd allows me to type something, and when i type randomly it says connection to host lost.

And if i change input it straight away gives the error. And I also tried cmd localhost 5000 on simple flask app same blank screen appear but when I type randomly in it it gives response back in html.

mawaishanif commented 6 years ago

After initial command.

It also shows a message "Connecting to 35.189.189.198 5672" but it disappear quickly. cap1

After I type randomly.

cap2

mawaishanif commented 6 years ago

I think the problem is with my computer. Library does not have to do anything with it. I tried it on https://repl.it and it worked fine.

Update: Pika library works on my computer too.