Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- wvzack
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
ok and the cloud logs cant be found in any way? (it wouldn't be your scratch password it would the password that confirms that you are what your turbowarp username is)TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcodeI want to make my scratchattach project work on turbowarp where you can enter a password but i am not sure if it is possible to view/ decode the cloud data logs which would make it easy to find other peoples passwords.
conn = session.connect_tw_cloud(“project_id”)
value = scratch3.get_tw_var(“project_id”, “variable”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
variables = scratch3.get_tw_cloud(“project_id”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
- TheCreatorOfUnTV
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
Nice! So, can you make a Scratch game in Python using this?
- wvzack
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
technically yes with pen but I wouldent do it (that could make a cool game contest) Nice! So, can you make a Scratch game in Python using this?
- elip100
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
(#2720)If it isn't your Scratch password then it is safeok and the cloud logs cant be found in any way? (it wouldn't be your scratch password it would the password that confirms that you are what your turbowarp username is)TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcodeI want to make my scratchattach project work on turbowarp where you can enter a password but i am not sure if it is possible to view/ decode the cloud data logs which would make it easy to find other peoples passwords.
conn = session.connect_tw_cloud(“project_id”)
value = scratch3.get_tw_var(“project_id”, “variable”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
variables = scratch3.get_tw_cloud(“project_id”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
Last edited by elip100 (Aug. 10, 2024 22:17:27)
- TheCreatorOfUnTV
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
What exactly are the problems?technically yes with pen but I wouldent do it (that could make a cool game contest) Nice! So, can you make a Scratch game in Python using this?
- wvzack
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
extremely slow and just would be quite hard to makeWhat exactly are the problems?technically yes with pen but I wouldent do it (that could make a cool game contest) Nice! So, can you make a Scratch game in Python using this?
- wvzack
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
So ScratchTheCoder12345 gave me a script for loading photos onto a project (thanks! ) however it can only load for one person at a time so if multiple people are on it will clog the cloud vars however every person will resive the same photo so I am wondering if there is a way to send it to everybody at the same time.
- TheCommCraft
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2688)Well you can but scratch doesn't *always* allow you to do that. It pretty much only works anymore for popular projects.Yeah, it seems like you simply can't get previous values of cloud variables in scratch without querying the cloud logs (and even then that won't always work).(#2683)After some troubleshooting, it seams that the problem is with the TwCloudConnection function. The .get_cloud() works with no issues. I even tried to do the same thing but use scratchcommunication to set the variables (It works, but not with Turbowarp's cloud server).
No offense, but this is not a great way to do this. It will spam turbowarp with unnecessary updates (unless scratchattach prevents changing a cloud variable that's already been changed, that could cause problems though). Plus, .get_cloud() is depreciated now, and does not work in the latest version of scratchattach, and even if you are using an older version that supports this I think you might need to connect to the scratch cloud server first.
You can update scratchattach to the latest version within your terminal.pip install scratchattach --upgrade
A better way to do this would be to open up the websocket connection to scratch yourself, and call .recv(), something like this: (untested, tell me if it doesn't work)#Import modules import scratchattach as scratch3 from dotenv import load_dotenv import os import time #To add rate limiter import websocket # websocket-client import json #Load the .env file(s) load_dotenv('app.env') #Set variables to the enviroment variables sessionID=os.getenv('sessionID') username=os.getenv('username') scratch_project=os.getenv('scratch_project') server=os.getenv('cloud_host') # Log into scratch session = scratch3.Session(sessionID, username=username) # Connect to scratch cloud server ws = websocket.WebSocket() ws.connect( "wss://clouddata.scratch.mit.edu", cookie="scratchsessionsid=" + session.session_id + ";", origin="https://scratch.mit.edu", enable_multithread=True ) # Connect to Turbowarp or another cloud server turbo_conn = scratch3.TwCloudConnection(project_id=scratch_project, username=username, cloud_host=server, purpose="A test for a bot that syncs Scratch variables to another cloud server", contact="zaid1442011 on scratch and [redacted]") while True: msgs = ws.recv().split('\n') for msg in msgs: if len(msg) == 0: continue parsed = json.loads(msg) if parsed['method'] == 'set': # Sets the variable in Turbowarp turbo_conn.set_var(parsed['name'][4:], parsed['value']) time.sleep(0.1) # Rate limiter (might not be needed)
(@TimMcCool, is there a better way of doing this? maybe cloud requests idk)
- TheCommCraft
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2694)When somebody had the issue in scratchcommunication I just implemented the option to disable the certificate (link to issue on github)
In the past, many people reported they were unable to connect to Scratch's cloud variables because they got this error:ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
I was never able to reproduce the error - until I recently stumbled upon it myself on a new device. I found a way to fix it which will be implemented in scratchattach soon / in a future update.
- TheCommCraft
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2719)Yes, anyone can just record the data. I would recommend you to be careful with that.ok and the cloud logs cant be found in any way? (it wouldn't be your scratch password it would the password that confirms that you are what your turbowarp username is)TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcodeI want to make my scratchattach project work on turbowarp where you can enter a password but i am not sure if it is possible to view/ decode the cloud data logs which would make it easy to find other peoples passwords.
conn = session.connect_tw_cloud(“project_id”)
value = scratch3.get_tw_var(“project_id”, “variable”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
variables = scratch3.get_tw_cloud(“project_id”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
You could use scratchcommunication which supports secure data transmission… (link to scratchcommunication)
- wvzack
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
okay I will look at that. Bacicly I want people to be able to use my “bank” project through turbowarp so they dont have to be a scratcher but I would need a way to confirm that they are who they say they are.(#2719)Yes, anyone can just record the data. I would recommend you to be careful with that.ok and the cloud logs cant be found in any way? (it wouldn't be your scratch password it would the password that confirms that you are what your turbowarp username is)TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcodeI want to make my scratchattach project work on turbowarp where you can enter a password but i am not sure if it is possible to view/ decode the cloud data logs which would make it easy to find other peoples passwords.
conn = session.connect_tw_cloud(“project_id”)
value = scratch3.get_tw_var(“project_id”, “variable”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
variables = scratch3.get_tw_cloud(“project_id”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
You could use scratchcommunication which supports secure data transmission… (link to scratchcommunication)
- redspacecat
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
You could try implementing your own version of scratch authokay I will look at that. Bacicly I want people to be able to use my “bank” project through turbowarp so they dont have to be a scratcher but I would need a way to confirm that they are who they say they are.(#2719)Yes, anyone can just record the data. I would recommend you to be careful with that.ok and the cloud logs cant be found in any way? (it wouldn't be your scratch password it would the password that confirms that you are what your turbowarp username is)TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcodeI want to make my scratchattach project work on turbowarp where you can enter a password but i am not sure if it is possible to view/ decode the cloud data logs which would make it easy to find other peoples passwords.
conn = session.connect_tw_cloud(“project_id”)
value = scratch3.get_tw_var(“project_id”, “variable”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
variables = scratch3.get_tw_cloud(“project_id”, purpose=“your use case (optional)”, contact=“your Scratch account or other contact info (optional)”)
You could use scratchcommunication which supports secure data transmission… (link to scratchcommunication)
- FutbolcuCiliPepe
- Scratcher
6 posts
scratchattach - A Scratch API wrapper (Python)
Hi!
I am new to scratchattach. My test project only works while the python code was running. What can I do?
I am new to scratchattach. My test project only works while the python code was running. What can I do?
Last edited by FutbolcuCiliPepe (Aug. 20, 2024 12:57:49)
- zaid1442011
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2732)https://auth.itinerary.eu.org/documentation/using-scratch-authYou could try implementing your own version of scratch authwdym?
- zaid1442011
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
It's supposed to be like that or it will be impractical. Hi!
I am new to scratchattach. My test project only works while the python code was running. What can I do?
You can do:
while True: #Your code here will run till you close the python program
- FutbolcuCiliPepe
- Scratcher
6 posts
scratchattach - A Scratch API wrapper (Python)
It's supposed to be like that or it will be impractical. Hi!
I am new to scratchattach. My test project only works while the python code was running. What can I do?
You can do:If you want to make a forever loop on Python.while True: #Your code here will run till you close the python program
Does it work if I close the python page? (And the code didn't work, are there any other solutions?)
Last edited by FutbolcuCiliPepe (Aug. 20, 2024 17:15:17)
- TheCommCraft
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2731)They would still need to implement authenticity and integrity checks if they stay logged inYou could try implementing your own version of scratch auth -snip-