TimMcCool / scratchattach

Scratch API wrapper with support for almost all site features and cloud requests framework
MIT License
174 stars 43 forks source link

I hosted code on PythonAnywhere, but: #177

Closed Boubou78000 closed 7 months ago

Boubou78000 commented 7 months ago

I was logged in, no problems. I try: conn=session.connect_cloud(‘14677652’) And then: File "/home/marc2011/.local/lib/python3.10/site-packages/scratchattach/cloud.py", line 77, in _connect self.websocket.connect( File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 244, in connect self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options), File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 132, in connect sock = _tunnel(sock, hostname, port, auth) File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 300, in _tunnel raise WebSocketProxyException( websocket._exceptions.WebSocketProxyException: failed CONNECT via proxy status: 403 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/marc2011/.local/lib/python3.10/site-packages/scratchattach/cloud.py", line 87, in _connect self.websocket.connect( File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 244, in connect self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options), File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 132, in connect sock = _tunnel(sock, hostname, port, auth) File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 300, in _tunnel raise WebSocketProxyException( websocket._exceptions.WebSocketProxyException: failed CONNECT via proxy status: 403 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/marc2011/.local/lib/python3.10/site-packages/scratchattach/session.py", line 363, in connect_cloud return cloud.CloudConnection(username = self._username, session_id = self.session_id, project_id = int(project_id) ) File "/home/marc2011/.local/lib/python3.10/site-packages/scratchattach/cloud.py", line 27, in __init__ self._connect(cloud_host=cloud_host) File "/home/marc2011/.local/lib/python3.10/site-packages/scratchattach/cloud.py", line 95, in _connect raise(exceptions.ConnectionError) scratchattach.exceptions.ConnectionError

Boubou78000 commented 7 months ago

I can’t understand where is the problem!

RadicalOfficial commented 7 months ago

Free accounts on PythonAnywhere have limited internet access so it cannot connect to websockets. https://www.pythonanywhere.com/forums/topic/32166/ Whitelisted sites for free accounts on PythonAnywhere: https://www.pythonanywhere.com/whitelist/

For me, hosting the code on https://render.com will not give the WebSocket error.

Boubou78000 commented 7 months ago

session_id = str(re.search('"(.*)"', request.headers["Set-Cookie"]).group()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/render/project/src/run.py", line 6, in Session=s3.login("Boubou78000", Secret) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/scratchattach/session.py", line 548, in login raise exceptions.LoginFailure("Either the provided authentication data is wrong or your network is banned from Scratch.\n\nIf you're using an online IDE (like replit.com) Scratch possibly banned its IP adress. In this case, try logging in with your session id: https://github.com/TimMcCool/scratchattach/wiki#logging-in")) scratchattach.exceptions.LoginFailure: Either the provided authentication data is wrong or your network is banned from Scratch. If you're using an online IDE (like replit.com) Scratch possibly banned its IP adress. In this case, try logging in with your session id: https://github.com/TimMcCool/scratchattach/wiki#logging-in

Looks like Scratch banned Render too :(

freundlich, Marc Lormelle.

Sicher versendet mit Proton Mail.

Knightbot63 @.***> schrieb am Dienstag, 20. Februar 2024 um 17:32:

Free accounts on PythonAnywhere have limited internet access so it cannot connect to websockets. https://www.pythonanywhere.com/forums/topic/32166/ Whitelisted sites for free accounts on PythonAnywhere: https://www.pythonanywhere.com/whitelist/

For me, hosting the code on https://render.com will not give the WebSocket error.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Boubou78000 commented 7 months ago

Sorry, the problem was in the Password...

freundlich, Marc Lormelle.

Sicher versendet mit Proton Mail.

Knightbot63 @.***> schrieb am Dienstag, 20. Februar 2024 um 17:32:

Free accounts on PythonAnywhere have limited internet access so it cannot connect to websockets. https://www.pythonanywhere.com/forums/topic/32166/ Whitelisted sites for free accounts on PythonAnywhere: https://www.pythonanywhere.com/whitelist/

For me, hosting the code on https://render.com will not give the WebSocket error.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>