Discuss Scratch

Yaveen2025
Scratcher
35 posts

Linking external API's to a scratch project

Hello Scratch!

So this thing is not known by many and I've tried countless searches on the web for this but does anyone know how to fetch data from an external API (such as a weather service) and then make a scratch project convert that into readable data. This could be useful to get data that is not provided in Scratch's inbuilt extensions.

Some other things
  • Please make your responses simple for me to understand because I have barely any experience in text based programming (other than micro-python).
  • Also, please don't hit me up with “this is not possible”, as it is and I've seen many examples, including the “Scratch search” project that was on trending a not long ago. If you don't know the answer, that is totally fine.
Thanks

Last edited by Yaveen2025 (Sept. 2, 2021 10:22:03)

MathPuppy314
Scratcher
500+ posts

Linking external API's to a scratch project

For anything that deals with the Scratch API or other things not in a default scratch project, post in Advanced Topics. I'm reporting this to get moved for you
RandomCocconut
Scratcher
500+ posts

Linking external API's to a scratch project

I think you should make an external script that it fetch API and change a cloud variable

Last edited by RandomCocconut (Sept. 2, 2021 13:51:12)

souleymane2
Scratcher
100+ posts

Linking external API's to a scratch project

Well if you'd want to do that you would have to create a bot that could read data inside of scratch and add data inside of scratch. I would recommend using a list since that would be veryt easy to add data. I have little to no experience in text programming so I can't hit you up with anything sorry.
Verixion
Scratcher
100+ posts

Linking external API's to a scratch project

You probably should create a numbers encoder/decoder in python and port it to scratch. Make sure it outputs the exact same thing – Then you should use scratchclient to transport the variables. Its a bit hard, but you should be able to do it!
ScratchCatHELLO
Scratcher
1000+ posts

Linking external API's to a scratch project

if you know python, you should install the requests and scratchclient (note: installing scratchclient requires C++ for some reason) pip modules

learn about http requests and the basics of requests and scratchclient.

then make a simple decoder/encoder in both scratch and python (all it has to do is convert characters into numbers).

that should be all you need to have to get started.

Last edited by ScratchCatHELLO (Sept. 2, 2021 23:40:01)

Yaveen2025
Scratcher
35 posts

Linking external API's to a scratch project

Thanks sooo much for your support!
Chiroyce
Scratcher
1000+ posts

Linking external API's to a scratch project

You can start with python, get a basic understanding of it, then as ScratchCatHELLO said, learn about HTTP(S) requests, and then you can learn how to use scratchclient.
Yaveen2025
Scratcher
35 posts

Linking external API's to a scratch project

Chiroyce wrote:

You can start with python, get a basic understanding of it, then as ScratchCatHELLO said, learn about HTTP(S) requests, and then you can learn how to use scratchclient.

about the scratchclient, theres nothing on the github page
Verixion
Scratcher
100+ posts

Linking external API's to a scratch project

Yaveen2025 wrote:

Chiroyce wrote:

You can start with python, get a basic understanding of it, then as ScratchCatHELLO said, learn about HTTP(S) requests, and then you can learn how to use scratchclient.

about the scratchclient, theres nothing on the github page
Did you see the press the classes (https://github.com/CubeyTheCube/scratchclient/wiki/ScratchSession)?

Powered by DjangoBB