Discuss Scratch

Reev0102
Scratcher
1000+ posts

Why doesn't this work?

When I ran
response = requests.get("https://api.scratch.mit.edu/users/ceebee/messages/count")
print(response.json()["count"])
it output
0

Then, when I visited the page through my browser, I saw this:
{"count":173672}

Why didn't my code work?

Last edited by Reev0102 (Aug. 16, 2021 14:07:22)

hello_smile
Scratcher
1000+ posts

Why doesn't this work?

Reev0102 wrote:

When I ran
response = requests.get("https://api.scratch.mit.edu/users/ceebee/messages/count")
print(response.json()["count"])
it output
0

Then, when I visited the site through my browser, I saw this:
{"count":173672}

Why didn't my code work?
Api restricted.
Reev0102
Scratcher
1000+ posts

Why doesn't this work?

hello_smile wrote:

Api restricted.
?
hello_smile
Scratcher
1000+ posts

Why doesn't this work?

Reev0102 wrote:

hello_smile wrote:

Api restricted.
?
Ask chiroyce.
CST1229
Scratcher
1000+ posts

Why doesn't this work?

The API intentionally returns
{"count":0}
when a computer with certain user agents that are usually related to programs tries to GET from the message count API and probably a few others.
Maybe that happened?

Last edited by CST1229 (Aug. 16, 2021 13:56:58)

Reev0102
Scratcher
1000+ posts

Why doesn't this work?

-FantasticScratcher- wrote:

Scratch Javascript On!
Scratch Javascript Python On!

Last edited by Reev0102 (Aug. 16, 2021 15:42:08)

CST1229
Scratcher
1000+ posts

Why doesn't this work?

Reev0102 wrote:

-FantasticScratcher- wrote:

Scratch Javascript On!
Scratch Javascript Python On!
Pyth On!
Chiroyce
Scratcher
1000+ posts

Why doesn't this work?

Hi there,

Someone requested the messages API A LOT using a script (python or JavaScript) and so the scratch team has put some restrictions for the message count api. The URL is still available but I don't think I'm allowed to share it now, so yeah, I'm sorry but the scratch team has had some struggles with the message count api and I'm very sure that they wouldn't like any external scripts to request the message count API.

So in short - please don't request the message count API.

Have a nice day and scratch Python on!

CST1229 wrote:

when a computer with ….
Maybe that happened?
I recommend you don't explain the problem with this - people may workaround this and spam the servers again, so why don't we just say that there are some “restrictions” and not exactly what those “restrictions” are?

Last edited by Chiroyce (Aug. 16, 2021 15:42:07)

Reev0102
Scratcher
1000+ posts

Why doesn't this work?

Closed as resolved.

Powered by DjangoBB