Rate limit with scratchattach library python

So i have been using replit to host scratchattach online using python. I keep getting a error saying ive been rate limited or ip limited. How do i fix this? would upgrading fix this issue?

If you’ve been rate limited, you’ve likely sent to many requests and will need to wait a while before sending more. Upgrading may fix this if the service offers more requests while using a premium plan.

2 Likes

I Dont think i sent alot of requests only 2 requests. and this is to get a request and return the word pong.

also im talking replit upgrading.

Is this a chat application? If so, do you know how many messages you can send before being limited?

You would only need to upgrade if you used all your egress, which it doesn’t seem like you have.

Im using scratchattach by timmccool on github…

on the cloud requests part of it and the simple pong test one dosent work and gets limited…

if u need il send the github link to the cloud requests thing im talking about

Oh, I see. Scratch may limit its own API. You may want to create an issue on GitHub or ask on Scratch’s own Forums, as this likely is not a Replit problem.

It works for everyone else that uses the same thing i do.

That’s odd. Would you be able to provide your code and/or repl link?

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 message_count(argument1):
    print(f"Message count requested for user {argument1}")
    user = scratch3.get_user(argument1)
    return user.message_count()

client.run() #make sure this is ALWAYS at the bottom of your Python file
1 Like

Is this the code that is currently in the project, or did you remove it for privacy?

1 Like

Privacy. because yeah lol

1 Like

and i know what goes there cuz when i do this locally it works but then i cant keep it running.

Could you provide the error message upon runtime?

sure let me make a replit and do the coding ill brb ok?

Oh, I just remembered from a while ago.

Don’t believe it will work from Replit sadly. For some reason, Scratch blocked Replit’s IPs, so you will need to find a different service or go local.

1 Like

No, with session ID scratchattach can pass the ban.
So @HunterFaulconbr’s code should work

I really have no idea how it works, but even the creator replied on the GitHub issue recommending using a different service or going local, so I doubt this is the case.

1 Like