ScratchData LogoScratchData
Back to pizza_eter's profile

SCRATCHATTACH test

PIpizza_eter•Created October 17, 2022
SCRATCHATTACH test
7
7
341 views
View on Scratch

Instructions

Open this in python: import scratchattach as scratch3 session = scratch3.login("username", "password") conn = session.connect_cloud("change this with your project id, it is in the url EXAMPLE:746702470 ") #replace with your project id client = scratch3.CloudRequests(conn) @client.request def ping(): #called when client receives request print("Ping request received") return "wait 5 seconds" #sends back 'pong' to the Scratch project @client.event def on_ready(): print("Request handler is running") @client.request def foo(argument1): print(f"Data requested for user {argument1}") user = scratch3.get_user(argument1) stats = user.stats() return_data = [] return_data.append(f"Total loves: {stats['loves']}") return_data.append(f"Total favorites: {stats['favorites']}") return_data.append(f"Total views: {stats['views']}") return return_data client.run() #make sure this is ALWAYS at the bottom of your Python file then run it, it should work now! And if it doesn't place a comment then i will try my best to help, and O remix this project else it doesn't work if you try this id, use your own.

Description

Credits to @timmccool

Project Details

Project ID746702470
CreatedOctober 17, 2022
Last ModifiedOctober 13, 2023
SharedOctober 17, 2022
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root