Discuss Scratch

wvzack
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

redspacecat wrote:

wvzack wrote:

Black-takashi_01 wrote:

wvzack wrote:

I 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)”)
what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcode
TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)
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)
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)

TheCreatorOfUnTV wrote:

Nice! So, can you make a Scratch game in Python using this?
technically yes with pen but I wouldent do it (that could make a cool game contest)
elip100
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

(#2720)

redspacecat wrote:

wvzack wrote:

Black-takashi_01 wrote:

wvzack wrote:

I 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)”)
what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcode
TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)
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)
If it isn't your Scratch password then it is safe

Last edited by elip100 (Aug. 10, 2024 22:17:27)

TheCreatorOfUnTV
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

TheCreatorOfUnTV wrote:

Nice! So, can you make a Scratch game in Python using this?
technically yes with pen but I wouldent do it (that could make a cool game contest)
What exactly are the problems?
wvzack
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

TheCreatorOfUnTV wrote:

wvzack wrote:

TheCreatorOfUnTV wrote:

Nice! So, can you make a Scratch game in Python using this?
technically yes with pen but I wouldent do it (that could make a cool game contest)
What exactly are the problems?
extremely slow and just would be quite hard to make
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)

elip100 wrote:

(#2674)

zaid1442011 wrote:

(#2674)
How can I get cloud variables of custom cloud servers?
Only Scratch and TurboWarp are supported
Wrong
TheCommCraft
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

MonkeyBean2 wrote:

(#2688)

zaid1442011 wrote:

MonkeyBean2 wrote:

(#2683)
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 with
pip install scratchattach --upgrade
in your terminal.

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)

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).
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).
Well you can but scratch doesn't *always* allow you to do that. It pretty much only works anymore for popular projects.
TheCommCraft
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

(#2694)
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.
When somebody had the issue in scratchcommunication I just implemented the option to disable the certificate (link to issue on github)
TheCommCraft
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

(#2719)

redspacecat wrote:

wvzack wrote:

Black-takashi_01 wrote:

wvzack wrote:

I 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)”)
what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcode
TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)
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)
Yes, anyone can just record the data. I would recommend you to be careful with that.
You could use scratchcommunication which supports secure data transmission… (link to scratchcommunication)
wvzack
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

TheCommCraft wrote:

wvzack wrote:

(#2719)

redspacecat wrote:

wvzack wrote:

Black-takashi_01 wrote:

wvzack wrote:

I 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)”)
what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcode
TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)
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)
Yes, anyone can just record the data. I would recommend you to be careful with that.
You could use scratchcommunication which supports secure data transmission… (link to scratchcommunication)
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.
redspacecat
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

TheCommCraft wrote:

wvzack wrote:

(#2719)

redspacecat wrote:

wvzack wrote:

Black-takashi_01 wrote:

wvzack wrote:

I 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)”)
what i mean was i wasent sure if it would be possible for people to see turbowarps data logs and then decode your passcode
TurboWarp doesn't have accessible cloud logs and also you aren't putting your password in there. (Unless I'm misunderstanding)
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)
Yes, anyone can just record the data. I would recommend you to be careful with that.
You could use scratchcommunication which supports secure data transmission… (link to scratchcommunication)
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.
You could try implementing your own version of scratch auth
wvzack
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

redspacecat wrote:

wvzack wrote:

TheCommCraft wrote:

wvzack wrote:

(#2719)

redspacecat wrote:

wvzack wrote:

Black-takashi_01 wrote:

wvzack wrote:

-snip-
You could try implementing your own version of scratch auth
wdym?

Last edited by wvzack (Aug. 20, 2024 03:50:27)

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?

Last edited by FutbolcuCiliPepe (Aug. 20, 2024 12:57:49)

zaid1442011
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

(#2732)
You could try implementing your own version of scratch auth
wdym?
https://auth.itinerary.eu.org/documentation/using-scratch-auth
zaid1442011
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

FutbolcuCiliPepe wrote:

Hi!

I am new to scratchattach. My test project only works while the python code was running. What can I do?
It's supposed to be like that or it will be impractical.
You can do:
while True:
    #Your code here will run till you close the python program
If you want to make a forever loop on Python.
FutbolcuCiliPepe
Scratcher
6 posts

scratchattach - A Scratch API wrapper (Python)

zaid1442011 wrote:

FutbolcuCiliPepe wrote:

Hi!

I am new to scratchattach. My test project only works while the python code was running. What can I do?
It's supposed to be like that or it will be impractical.
You can do:
while True:
    #Your code here will run till you close the python program
If you want to make a forever loop on Python.

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)

redspacecat wrote:

(#2731)

wvzack wrote:

-snip-
You could try implementing your own version of scratch auth
They would still need to implement authenticity and integrity checks if they stay logged in
elip100
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

TheCommCraft wrote:

(#2726)

elip100 wrote:

(#2674)

zaid1442011 wrote:

(#2674)
How can I get cloud variables of custom cloud servers?
Only Scratch and TurboWarp are supported
Wrong
Not wrong

Powered by DjangoBB