Closed mawaishanif closed 6 years ago
You pass an invalid URL I guess. Pass the connection URL in this format:
amqp://{username}:{password}@{host}:{port}/{vhost}
As I can see you have 35.183.159.128 on Amazon Cloud. Did you check the firewall settings?
"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.
I am still getting the same error, here is the actual URL "amqp://wvekznkq:password@mustang.rmq.cloudamqp.com/wvekznkq"
Could you try to connect using telnet 35.183.159.128 5672
?
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"
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.
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.
After initial command.
It also shows a message "Connecting to 35.189.189.198 5672" but it disappear quickly.
After I type randomly.
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.
`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.