Forums

socket.error: [Errno 111] Connection refused

Hi I'm kind of new to python and completely new to pythonanywhere. I have a bot that logs into the app called LINE. I was simply trying to run the bot in another place besides my local machine. I have the bot working fine when I run it through local server, but my pc does not stay connected to net 24 hours a day. I was stuck for a while because the bot runs off of python 2.7 and I finally figured out how to change the virtualenv settings to python2.7. This also allowed me to finally get the version of thrift, rsa, and requests, which the bot uses. Now it seems like the bot is going to work when I run it through pythonanywhere but after a pause it throws an error like I'm being rejected. Please can someone tell me what I am doing wrong and how to fix the issue?

Error I am recieving: socket.error: [Errno 111] Connection refused

Entire error:

(my-virtualenv) 08:22 ~/LIN3-TCR (master)$ python STW.py

Traceback (most recent call last):

File "STW.py", line 10, in <module>

cl.login(qr=True)

File "/home/Selfishbot/LIN3-TCR/LINETCR/LineApi.py", line 34, in login

self.Talk.qrLogin(callback)

File "/home/Selfishbot/LIN3-TCR/LINETCR/Api/Talk.py", line 93, in qrLogin

qr = self.client.getAuthQrcode(True, "Bot")

File "/home/Selfishbot/LIN3-TCR/LINETCR/Api/../lib/curve/LineService.py", line 9272, in getAuthQrcode

self.send_getAuthQrcode(keepLoggedIn, systemName)

File "/home/Selfishbot/LIN3-TCR/LINETCR/Api/../lib/curve/LineService.py", line 9282, in send_getAuthQrcode

self._oprot.trans.flush()

File "/home/Selfishbot/.virtualenvs/my-virtualenv/local/lib/python2.7/site-packages/thrift/transport/THttpClient.py", line 107, in _f

result = f(*args, **kwargs)

File "/home/Selfishbot/.virtualenvs/my-virtualenv/local/lib/python2.7/site-packages/thrift/transport/THttpClient.py", line 141, in flush

self.__http.endheaders()

File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders

self._send_output(message_body)

File "/usr/lib/python2.7/httplib.py", line 864, in _send_output

self.send(msg)

File "/usr/lib/python2.7/httplib.py", line 826, in send

self.connect()

File "/usr/lib/python2.7/httplib.py", line 1216, in connect

self.timeout, self.source_address)

File "/usr/lib/python2.7/socket.py", line 571, in create_connection

raise err

socket.error: [Errno 111] Connection refused

HI there, free users have restricted Internet and need to go via our proxy server. we have some environment variables set so that most Http libraries (like "requests" for example) auto-detect the proxy and use it, but from that traceback it looks like your library isn't doing that...

if you have an option to configure a proxy you might be able to get it to work -- assuming the endpoint is on our whitelist. alternatively, paid accounts have unrestricted internet...

final suggestion -- if you're trying to run some code 24/7, see this page http://help.pythonanywhere.com/pages/LongRunningTasks -- again, you'll need a paid account to get this working really.

Ok, my endpoint that is failing I believe would be https://gd2.line.naver.jp:443. The api for this endpoint is located at Line.me, which is included in the whitelist. https://gd2.line.naver.jp:443 is the endpoint used to allow a qr login through line.me. Can you please whitelist the endpoint which i need to login.

If you type line.naver.jp in your browser you will see that it redirects you to line.me, which is in the whitelist.

To clarify, we want to see api documentation in order to whitelist a site. (ie. something like an official line website that says, "hi, we welcome people accessing gd2.line.naver.jp. for example, you could post to gd2.line.naver.jp/newchat/ with a message and it will do xyz")

Could you provide soemthing like that?