Discuss Scratch

ItsDrinkable
Scratcher
40 posts

scratchattach - A Scratch API wrapper (Python)

Can you make a tutorial on YT or something?
ajskateboarder
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

WojtekGame wrote:

so, scratchattach.

(i don't think there will be an typescript port neither.)
There's meowclient for TypeScript, although not a direct port of scratchattach. It's well documented and has a nice API
ajskateboarder
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

yalavarthishamit wrote:

Can you make a tutorial on YT or something?
Consider looking at the documentation on the GitHub repo. Using scratchattach assumes a base-level understanding of Python

infintyrussia wrote:

How exactly do the CloudEvents work? Do they just constantly check the var or does Scratch some how ping the server?
If you use `WsCloudEvents`, scratchattach listens for events from Scratch's cloud event WebSockets API. However, the docs only mention `CloudEvents` which polls HTTP cloud event logs. If I used scratchattach often, I would just stick with `WsCloudEvents` since it's more efficient for long operations.
infintyrussia
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

-FreeEngines- wrote:

infintyrussia wrote:

infintyrussia wrote:

infintyrussia wrote:

How exactly do the CloudEvents work? Do they just constantly check the var or does Scratch some how ping the server?
Can someone please explain? Thanks!
Can someone please explain?
If nobody can explain this to me then how would I be able to find this out myself?
that is probaply how its done.
just safe a value x for the cloud variables value, and check if the value of the cloud variable is or isnt equal to its “old” value x, and if it isnt, fire the event
So this is ineffective. And what if the value is the same? It still detects it.
infintyrussia
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

ajskateboarder wrote:

yalavarthishamit wrote:

Can you make a tutorial on YT or something?
Consider looking at the documentation on the GitHub repo. Using scratchattach assumes a base-level understanding of Python

infintyrussia wrote:

How exactly do the CloudEvents work? Do they just constantly check the var or does Scratch some how ping the server?
If you use `WsCloudEvents`, scratchattach listens for events from Scratch's cloud event WebSockets API. However, the docs only mention `CloudEvents` which polls HTTP cloud event logs. If I used scratchattach often, I would just stick with `WsCloudEvents` since it's more efficient for long operations.
Ok! Can you give me a quick code snippet of the WsCloudEvents. I am not sure how to do that. I need max efficiency for long term. Thanks!
ajskateboarder
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

infintyrussia wrote:

Ok! Can you give me a quick code snippet of the WsCloudEvents. I am not sure how to do that. I need max efficiency for long term. Thanks!
Turns out that `CloudRequests` uses `WsCloudEvents` by default, so I gave an example for that instead.
import scratchattach as scratch3
session = scratch3.Session("session_id", username="username") #replace with your session_id and username
conn = session.connect_cloud("project_id") #replace with your project id
client = scratch3.CloudRequests(conn)
@client.request
def ping(): #called when client receives request
    print("Ping request received")
    return "pong" #sends back 'pong' to the Scratch project
@client.event
def on_ready():
    print("Request handler is running")
client.run()
infintyrussia
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

ajskateboarder wrote:

infintyrussia wrote:

Ok! Can you give me a quick code snippet of the WsCloudEvents. I am not sure how to do that. I need max efficiency for long term. Thanks!
Turns out that `CloudRequests` uses `WsCloudEvents` by default, so I gave an example for that instead.
import scratchattach as scratch3
session = scratch3.Session("session_id", username="username") #replace with your session_id and username
conn = session.connect_cloud("project_id") #replace with your project id
client = scratch3.CloudRequests(conn)
@client.request
def ping(): #called when client receives request
    print("Ping request received")
    return "pong" #sends back 'pong' to the Scratch project
@client.event
def on_ready():
    print("Request handler is running")
client.run()
But I need the cloud events. I know how to use cloud requests but idk how to use cloud events. Can you please give me an example?
fluo1234
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

NeonG4 wrote:

fluo1234 wrote:

aw they banned replit thats the only ide i have
If you still want to code in replit, try firewalledreplit.com, however it can't connect to the real world.
i ment that replit cant conect to scratc h
Jake_Playz99
Scratcher
40 posts

scratchattach - A Scratch API wrapper (Python)

.

Last edited by Jake_Playz99 (March 17, 2023 19:20:02)

coolcode22
Scratcher
27 posts

scratchattach - A Scratch API wrapper (Python)

(long unnecessary quote removed by moderator - please don't spam)

PLEASE MAKE IT HTML

Last edited by Paddle2See (April 19, 2023 09:59:37)

bigspeedfpv
Scratcher
500+ posts

scratchattach - A Scratch API wrapper (Python)

coolcode22 wrote:

PLEASE MAKE IT HTML
??
BreadcatGames
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

development stopped on this, I think you guys might want to find another scratch api wrapper for python
ajskateboarder
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

BreadcatGames wrote:

development stopped on this, I think you guys might want to find another scratch api wrapper for python
It's still stable though
MicroRu
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

BreadcatGames wrote:

development stopped on this, I think you guys might want to find another scratch api wrapper for python
scratchclient
0_dan_0
Scratcher
20 posts

scratchattach - A Scratch API wrapper (Python)

insan but im on chromebook (((((((((((((((((((((((((((
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

coolcode22 wrote:

TimMcCool wrote:

Scratch API wrapper with support for almost all site features. The library can set cloud variables, follow Scratchers, post comments and do so much more!

It has special features that make it easy to transmit data through cloud variables.

Available on PyPi and on GitHub: https://github.com/TimMcCool/scratchattach

Quick Documentation

(Full documentation) (Official studio for scratchattach projects)

Installation:

Run this command in your command prompt / shell:
pip install -U scratchattach

Features:

- Get and set cloud variables on any Scratch project

- Cloud events

- Cloud requests that allow Scratch projects and Python to interact

- Get and interact with users, projects and studios

- Get and interact with Forum Posts / Topics

… and much more!

Examples

Setting a cloud var with scratchattach:
import scratchattach as scratch3

session = scratch3.login("username", "password")
conn = session.connect_cloud("project_id")

conn.set_var("variable", value)
Cloud Requests:
Link to examples

Cloud event handler:
import scratchattach as scratch3
events = scratch3.CloudEvents("project_id")

@events.event
def on_set(event): #Called when a cloud var is set
print(f"{event.user} set the variable {event.var} to the valuee {event.value} at {event.timestamp}")

events.start()

(Full documentation) (Official studio for scratchattach projects)

Support and Bug Report

If you have a question, ask here or create an issue on the repo.

Reasons to use scratchattach

➥ Simple to use
➥ Fast and safe
➥ Cloud events & built-in class for encoded cloud requests
➥ Users, projects, comments, search, explore & more!
➥ Forum posts and topics
➥ Most features don't require a session
➥ Open-source



Note
This topic is for talking about scratchattach and reporting bugs / glitches, not for advertising projects or other libraries.
PLEASE MAKE IT HTML
what? how would html be used in any context with this?
MicroRu
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Guys, why do I get an error when I receive a profile comment? It is connected to the API, which is located on Replit.
Knightbot63
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

MicroRu wrote:

(#1543)
Guys, why do I get an error when I receive a profile comment? It is connected to the API, which is located on Replit.
What's the code you are trying to run? Scratch has blocked ALL of replit's communication without a proxy of some sorts.
fluo1234
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

coolcode22 wrote:

TimMcCool wrote:

Scratch API wrapper with support for almost all site features. The library can set cloud variables, follow Scratchers, post comments and do so much more!

It has special features that make it easy to transmit data through cloud variables.

Available on PyPi and on GitHub: https://github.com/TimMcCool/scratchattach

Quick Documentation

(Full documentation) (Official studio for scratchattach projects)

Installation:

Run this command in your command prompt / shell:
pip install -U scratchattach

Features:

- Get and set cloud variables on any Scratch project

- Cloud events

- Cloud requests that allow Scratch projects and Python to interact

- Get and interact with users, projects and studios

- Get and interact with Forum Posts / Topics

… and much more!

Examples

Setting a cloud var with scratchattach:
import scratchattach as scratch3

session = scratch3.login("username", "password")
conn = session.connect_cloud("project_id")

conn.set_var("variable", value)
Cloud Requests:
Link to examples

Cloud event handler:
import scratchattach as scratch3
events = scratch3.CloudEvents("project_id")

@events.event
def on_set(event): #Called when a cloud var is set
print(f"{event.user} set the variable {event.var} to the valuee {event.value} at {event.timestamp}")

events.start()

(Full documentation) (Official studio for scratchattach projects)

Support and Bug Report

If you have a question, ask here or create an issue on the repo.

Reasons to use scratchattach

➥ Simple to use
➥ Fast and safe
➥ Cloud events & built-in class for encoded cloud requests
➥ Users, projects, comments, search, explore & more!
➥ Forum posts and topics
➥ Most features don't require a session
➥ Open-source



Note
This topic is for talking about scratchattach and reporting bugs / glitches, not for advertising projects or other libraries.
PLEASE MAKE IT HTML
how do you code a program in html html is for making websites do you mean js
MicroRu
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Knightbot63 wrote:

MicroRu wrote:

(#1543)
Guys, why do I get an error when I receive a profile comment? It is connected to the API, which is located on Replit.
What's the code you are trying to run? Scratch has blocked ALL of replit's communication without a proxy of some sorts.
I want to receive comments in my profile. How to do it?

Powered by DjangoBB