Discuss Scratch

BwnnyRxbbit
Scratcher
500+ posts

Problem with using scratch's API

This code is not mine but from a fellow forumer.
import requests
response = requests.get("https://scratch.mit.edu/users/BwnnyRxbbit/")
if response.status_code == 200:
    print(response.json())
else:
    print(f"request failed, error code: {response.status_code}")

I'm trying to use scratch's API for some projects. However I'm having trouble connecting to scratch's API. In seems like the error is with line 4. I've also tried a different code also provided by someone else but it only prints Success to my console. How do I view the data? I've installed all of the nessessary things such as requests and it has worked on an other very simple project using the requests module.

Last edited by BwnnyRxbbit (April 6, 2024 04:01:58)

Mrcomputer1
Scratcher
500+ posts

Problem with using scratch's API

BwnnyRxbbit
Scratcher
500+ posts

Problem with using scratch's API

Mrcomputer1 wrote:

https://scratch.mit.edu/users/BwnnyRxbbit/ is the website, not the API. The API is https://api.scratch.mit.edu/users/BwnnyRxbbit.
Whoops… Thanks for letting me know!

Powered by DjangoBB