Forums

cannot connect by socket

I tried connect to facebook. Another servers return same error:

Python 3.3.2+ (default, Feb 28 2014, 00:52:16)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.

import socket
sock=socket.socket()
sock.connect(('127.0.0.1',80))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ConnectionRefusedError: [Errno 111] Connection refused
sock.connect(('173.252.110.27',80))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ConnectionRefusedError: [Errno 111] Connection refused

https://www.pythonanywhere.com/wiki/403ForbiddenError

i don't think they whitelist ips, try using domain/url

Free accounts don't have direct access to the internet. All network access on free accounts go through a proxy that has a whitelist and uses the domain name to determine whether you are allowed access to the site.