Save data for your games easily! Tutorial in project. Script to run: import pickle as p import scratchattach as scratch3 from better_profanity import profanity session = scratch3.login("username", "password") #replace with your data conn = session.connect_cloud(project_id="project ID") #replace with your project id def censor(text): profanity.load_censor_words() return profanity.censor(text) def prof_check(text): return profanity.contains_profanity(text) client = scratch3.CloudRequests(conn) file_name = 'file_name' #Replace this with your text file's name try: with open(file_name, 'rb') as file: user_data = p.load(file) except: user_data = {} print('Reseting Server Data') pass @client.request def ping(): #called when client receives request print("Ping request received") return "pong" #sends back 'pong' to the Scratch project @client.request def save(username, save_data): user_data[username] = censor(save_data) with open(file_name, 'wb') as file: p.dump(user_data, file) if prof_check(save_data): return "your save data was censored" else: return "saved" @client.request def get(username): with open(file_name, 'rb') as file: return p.load(file)[username] @client.event def on_ready(): print("Request handler is ready") client.run() sure this is ALWAYS at the bottom of your Python file!
This uses scratchattach by @TimMcCool Most of the python script is by me, and the parsing script is also by me. All else by @TimMcCool