(Code below) Now you can turn Python into an API with code I wrote and then call it! This took me hours to make, special character combinations, skill, knowledge, and perseverance. (And 156 blocks) Prepare to be amazed. Just use the GET custom block when the server (code below) is running and it will output a response with no limit! None. Zero. Server instructions: BEFORE RUNNING, run "pip3 install scratchattach requests" on the command prompt. Then, just copy and paste this into a .py file (to run, use python3 path/to/python/file): import scratchattach, requests, getpass, time print("Press Ctrl+C to exit at any time.") sess=scratchattach.login(input("Enter your username: "), getpass.getpass("Password (Hides itself):")) conn=sess.connect_cloud(input("What's the project ID?\n")) encoder=scratchattach.Encoding() def main(rors): count=1 try: print(f"Python server has {rors}!") while True: if conn.get_var("GET")!="0": message=encoder.decode(conn.get_var("GET")) if message: output=requests.get(message) out=output.text while out!="": if len(out)>128: conn.set_var("GET", encoder.encode(out[0:123]+"._C.-")) out=out[123:len(out)] else: conn.set_var("GET", encoder.encode(out)) out="" time.sleep(3) else: conn.set_var("GET", encoder.encode("error")) time.sleep(3) conn.set_var("GET", "0") conn.disconnect() time.sleep(5) conn.reconnect() time.sleep(2) count+=1 if count>=10: conn.disconnect() time.sleep(5) conn.reconnect() count=1 except KeyboardInterrupt: if input("Press enter to stop, press r and enter to resume.") in ["r", "R", "resume"]: main("resumed") else: conn.disconnect() main(rors="started")
Uses 's Scratchattach and encoder. Finally! It works! Only uses a single cloud variable, which is probably part of why it took a long time, but it's DONE!!!