ConnectionRefusedError: [Errno 111] Connection refused

Hello, Im a free user and want to use python and connect with website using freelancer sdk. I get this error. is not whitelisted? ConnectionRefusedError: [Errno 111] Connection refused

No, it's not whitelisted, but if you can give us a link to their API documentation then we can whitelist it.

Thank you for your quick response. here is documentation link: how soon can it be whitelisted? week,month,year?

It's whitelisted now :-)

thank you :)

one more question. I try to connect with freelancer with script and error says this : Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/urllib3/", line 141, in _new_conn (, self.port), self.timeout, **extra_kw) File "/usr/local/lib/python3.6/dist-packages/urllib3/util/", line 83, in create_connection raise err File "/usr/local/lib/python3.6/dist-packages/urllib3/util/", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

is this problem of whitelisting or something else? sorry if question is nonsense cause Im really newbie . :)

It's related to whitelisting, yes. When you want to access an external website from a free account, you need to go via a proxy. Modern HTTP libraries like requests will do that automatically (they detect the proxy settings from the environment), but some (like urllib3) need extra configuration. If you're writing the code to connect to freelancer yourself, just use requests.get and it should work fine.

Thank you again for so helpful answer. as I'm not writing it and using freelance sdk which uses urllib3, I would be glad if you could tell me where to find info how to configure it. is there any thread on your website about this?

I think you're the first person to use the SDK on our site; if you look at their documentation, though, they should have an explanation of how to use it with a proxy -- you'll have to somehow specify a proxy hostname and port. You can find out what values to use from those by doing echo $http_proxy in a bash console. The result will be something like http://proxy.server:3128, which means that the servername is proxy.server and the port is 3128.

Thank you! case closed :)


Hi, I also got the same error code when trying to connect to Beams PUSHER and using their python SDK. I'm not sure if it's related to this topic too. It works when I request a token but failed to send the notification. Thank you for the help!

I checked the list and it is on the whitelist. So if anyone can help why the error occurred would be very thank you!

What code are you using to connect to it? Is it an API module that someone else has written, or your own code using an HTTP library? If it's the latter, try using requests rather than (say) urllib2 -- requests to whitelisted sites have to go via a proxy, and requests will handle that automatically for you, whereas the built-in libraries need special configuration.

Hi! I use the API module in the SDK and I also asked the developer team. They don't think the proxy is the issue. The domain format they use in this SDK is as below: "<INSTANCE_ID>". The domain "" is whitelisted, but is the above domain also whitelisted or only support single layer of the subdomain?

Thank you for all the help!

The URL <INSTANCE_ID> is on the whitelist because of the entry.

I have the same problem. I am connecting to the Minecraft server via the mcstatus library but get the same error. I can't rewrite the library.

That's not on the whitelist, so rewriting the library will not help, anyway.

@glenn so what do I do?

If there's a public API for the data that you're trying to access, then send us a link to the documentation for that API and we can add it. Here, this library pings a certain Minecraft server and shows you stats. However, it can't connect in PythonAnywhere.

What we need is public documentation for the minecraft server that shows that the administrators of the server are happy for their site to be used by libraries like mcstatus.

Here's the documentation:

This library simply pings the Minecraft server and tells how many players are in. It's nothing more than entering Minecraft and looking it up there. "mcstatus provides an easy way to query Minecraft servers for any information they can expose. "

Also, the library is written by Minecraft dev. It simply connects to their servers and takes VISIBLE info.

None of that constitutes public documentation for the use of the API on Without that, we do not know if the administrators of the site are happy for you to be hitting it using a program.

Fine, I'll ask the admin. And it's not "hitting" them, since it's the same as opening Minecraft and doing the same manually.

hitting just means making a http request and getting a http response

And what's the problem with that? If I write a game and then make a program that scans certain things in the game, I am allowed to since it's my game. Same goes for a library written by the game dev. Plus I am doing it on my own computer (but of course it can't run 24/7), so there is no difference, AND it's not such a big deal, a tiny ping every 5 minutes.

If we whitelist something, any free user can access it. So while your own program might be accessing the site responsibly, hackers could use our systems to attack it. They would not be traceable if they were using free accounts, so we could wind up being blamed.

So in theory, we should block all outbound Internet access for free accounts. However, we take the view that if the owner of a site has officially stated that it's OK for people to connect to their site using an API, they are aware of the risks and can handle any attacks themselves -- so we under those circumstances we can whitelist the site in question.


Ok, I've asked the server owner and he said he'll talk to you.

I have received a positive answer from the admin, which says he talked to you, but still doesn't work. MinecraftServer.lookup("") doesn't work.

Can you fix this please? I have permission

I can't find anything relating to in our tech support archives, so I don't think the admin of that site has been in touch with us.

hi i have the connection refused when try to expand shortlinks from amazon or, is in whitelist?

If you provide the api endpoint documentation we can consider adding it to the whitelist.

is not for api connection, is only a query to know the long link from a shortened link

We can only whitelist sites that are official documented public APIs.

Hello. I'm getting the same connection refused error when using pythonopensubtitles to pull subtitles from The website's API documentation is here . Can you please see if this site can be whitelisted as well?

We do have on the whitelist, so it sounds like the package you're using does not pay attention to the proxy settings in the system environment, and is trying to connect to the site directly. You'll have to find out how to get the package to work with a proxy -- I took a look around on their github page, but unfortunately there's nothing obvious there about how to do that.

Hello @giles, i have the same 111 Error, this time I am trying to use Telegram's API with this

Hi. same [Errno 111] problem with pyrogram(Telegram API).

@danielqba that sounds strange -- you have a paid account, so you have unrestricted Internet access. Your code can connect directly to Telegram's API without going through any of our firewall systems. Could you post the code you're using (without any passwords, of course)?

@88matin88 -- you have a free account, so you can only make outwards connections using HTTP or HTTPS, to whitelisted sites, so I don't think you can use the MTProto API, which doesn't use HTTP or HTTPS -- it has its own protocol.

@giles, nevermind, that was before I got a paid account. :)

Thanks for letting us know!

Hello, I am a new user and so far using free account. Trying to access API but getting a Connection Refused Error. Here is theirs documentation ->

Could you please suggest, should I move to paid account to be able to connect it or just needs to be added in whitelist?

It looks like that API is not based on HTTP or HTTPS, so it won't work from a free account -- whitelisted sites can only be accessed using those protocols, not raw socket connections.

From a paid account, you would have unrestricted Internet access and could connect to any site that allows connections, using any protocol.

Hello, I am a new user using a free account. I am using an AWS DB yet my connections are getting refused, could you please suggest what I should do next to ensure my connections are successful. I ran the same code locally and the connections have been succesful.

This is a follow up from a question I just asked, I just checked the whitelist and confirmed is on it yet I am still getting my connection refused.

Thank you

Could you share your code and the error message you are getting?

Hello i have the same error of ConnectionRefusedError: [Errno 111] Connection refused

@RayDraw that's likely because you're using a free account which has restricted internet access to whitelisted domains.

Hello, Im a free user and want to use python and connect with outlook smtp server . I get this error.... ConnectionRefusedError: [Errno 111] Connection refused. Is not '' whitelisted?


Ciao ho creato la mia webapp con python e flask l'ho caricata correttamente su python everywhere ma quando avvio il software mi da errore 111 requests.exceptions.ConnectionError: HTTPConnectionPool(host='', port=8001): Max retries exceeded with url: /chain (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fce8f6dd550>: Failed to establish a new connection: [Errno 111] Connection refused') non so proprio cosa fare, help me

There is not and never really will be a server running on, so you will never be able to connect to it.

Is there any restriction on accessing any website for paid plans as well?

Paid accounts have unrestricted internet access on PythonAnywhere, which means that there are no restrictions for outgoing connections.

Hello, Im a free user and I am trying to get information about my minecraft server with mcstatus (, but I get error "ConnectionRefusedError".

Could you provide the full error message, including the stack trace?