PythonAnywhere - Are sockets allowed?

ぐ巨炮叔叔 提交于 2019-12-11 04:39:34

问题


I have a beginner PythonAnywhere account, which, the account comparison page notes, have "Access to External Internet Sites: Specific Sites via HTTP(S) Only."

So I know only certain hosts can be accessed through HTTP protocols, but are there restrictions on use of the socket module? In particular, can I set up a Python server using socket?


回答1:


PythonAnywhere dev here. Short answer: you can't run a socket server on PythonAnywhere, no.

Longer answer: the socket module is supported, and from paid accounts you can use it for outbound connections just like you could on your normal machine. On a free account, you could also create a socket connection to the proxy server that handles free accounts' Internet access, and then use the HTTP protocol to request a whitelisted site from it (though that would be hard work, and it would be easier to use requests or something like that).

What you can't do on PythonAnywhere is run a socket server that can be accessed from outside our system.




回答2:


Nope. PythonAnywhere doesn't support the socket module.



来源:https://stackoverflow.com/questions/46018426/pythonanywhere-are-sockets-allowed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!