Forums

ConnectionRefusedError: [Errno 111] Connection refused

Hello, Im a free user and want to use python and connect with freelancer.com website using freelancer sdk. I get this error. is not freelancer.com 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: https://developers.freelancer.com 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/connection.py", line 141, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "/usr/local/lib/python3.6/dist-packages/urllib3/util/connection.py", line 83, in create_connection raise err File "/usr/local/lib/python3.6/dist-packages/urllib3/util/connection.py", 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 https://pusher.com/ 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>.pushnotifications.pusher.com". The domain ".pusher.com" 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>.pushnotifications.pusher.com is on the whitelist because of the .pusher.com entry.

I have the same problem. I am connecting to the Minecraft server Nox.gs 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.

https://pypi.org/project/mcstatus/. 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: https://github.com/Dinnerbone/mcstatus

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 Nox.gs. 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.

Oh.

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("noxcrewfactory.com") doesn't work.

Can you fix this please? I have permission

I can't find anything relating to noxcrewfactory.com 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 https://amzn.to/xxx or http://amzla.com/xxxx, 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 opensubtitles.org. The website's API documentation is here https://trac.opensubtitles.org/projects/opensubtitles/wiki/XMLRPC . Can you please see if this site can be whitelisted as well?

We do have api.opensubtitles.org 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.