Discuss Scratch

Dinosu
Scratcher
82 posts

Public CloudHead API Endpoints

CloudHead's Public Web API's

CloudHead is a monitoring service that allows a user's servers to stay alive 24/7. Its interface is based in Scratch, and consequently a user's monitors are saved under their Scratch account's name.

CloudHead's backend servers were all made with Flask, and there are multiple endpoints that are available to the public and don't require access keys.

(All other endpoints require a 256 byte access key, including every POST and DELETE endpoint and the GET endpoints that retrieve a user's personal monitor information.)



Status of CloudHead pinger

Get status of CloudHead monitor pinging server:
GET https://cloudhead-api.pygrammer5.repl.co

Example response:
{"status": "up"}



Status of CloudHead cloud server

Get status of CloudHead Scratch cloud server:
GET https://cloudhead-cloud-server.pygrammer5.repl.co

Example response:
{"status": "up"}



List of CloudHead users

Get a list of users that have made at least one monitor, from newest to oldest:
GET https://cloudhead-api.pygrammer5.repl.co/users/list

Example response:
[
     "griffpatch",
     "TimMcCool",
     "Will_Wam",
     "ceebee",
     "nini2009ph",
     ...
]

Parameters:
count: int ≤ 100 — max number of users to retrieve
offset: int — offset from index 0 of users to retrieve

Parameters example:
GET https://cloudhead-api.pygrammer5.repl.co/users/list?count=2&offset=2
— gets the 3rd and 4th most recent people to make their first CloudHead monitor



Total number of CloudHead users

Get the total number of CloudHead users who have made at least one monitor:
GET https://cloudhead-api.pygrammer5.repl.co/users/count

Example response:
{"count": 1234}



List of most famous CloudHead users

Get a list of the most followed people who made at least one CloudHead monitor, as of the time they made their most recent monitor:
GET https://cloudhead-cloud-server.pygrammer5.repl.co/famous-users

Example response:
[
     {
          "name": "griffpatch",
          "follower_count": 398855
     },
     {
          "name": "Will_Wam",
          "follower_count": 90168
     },
     {
          "name": "ceebee",
          "follower_count": 57363
     },
     {
          "name": "TimMcCool",
          "follower_count": 40945
     },
     {
          "name": "nini2009ph",
          "follower_count": 8152
     }
]



Number of monitors a user has

Get the number of monitors that a user currently has:
GET https://cloudhead-api.pygrammer5.repl.co/:user/monitors/count

Example response:
{"count": 3}

Last edited by Dinosu (Aug. 27, 2022 02:07:12)

infintyrussia
Scratcher
100+ posts

Public CloudHead API Endpoints

Very cool, but will the backend ever overload pinging this many projects? Like I am using 1 server that handles multiple scratch projects and if I add over 10 it may become a bit delayed.

Thanks
Dinosu
Scratcher
82 posts

Public CloudHead API Endpoints

infintyrussia wrote:

Very cool, but will the backend ever overload pinging this many projects? Like I am using 1 server that handles multiple scratch projects and if I add over 10 it may become a bit delayed.

Thanks

It will take a very long time before the server becomes incapable because the backend uses threading to ping many, many monitors at once.
TCTC112
Scratcher
30 posts

Public CloudHead API Endpoints

how are you running your python script 24/7? Before, I was using repl.it and uptimerobot, but since scratch banned repl.it, the script stops working once in a while, and completely erases all codes and what not saved in the array lists. Does this mean that you have another computer running 24/7, or are you using another way?
Dinosu
Scratcher
82 posts

Public CloudHead API Endpoints

TCTC112 wrote:

how are you running your python script 24/7? Before, I was using repl.it and uptimerobot, but since scratch banned repl.it, the script stops working once in a while, and completely erases all codes and what not saved in the array lists. Does this mean that you have another computer running 24/7, or are you using another way?

I'm using Replit's cycles in order to keep my pinging program running
silvxrcat
Scratcher
500+ posts

Public CloudHead API Endpoints

i don't get what this is supposed to be, what is this useful for?
infintyrussia
Scratcher
100+ posts

Public CloudHead API Endpoints

Dinosu wrote:

infintyrussia wrote:

Very cool, but will the backend ever overload pinging this many projects? Like I am using 1 server that handles multiple scratch projects and if I add over 10 it may become a bit delayed.

Thanks

It will take a very long time before the server becomes incapable because the backend uses threading to ping many, many monitors at once.
Just one problem I ran into. When pinging a site, it may just not respond for a few seconds. I don't know how you would handle this.
Edit: Since you use threading do you just switch it off after a while?

Last edited by infintyrussia (Aug. 24, 2022 02:26:29)

silvxrcat
Scratcher
500+ posts

Public CloudHead API Endpoints

silvxrcat wrote:

i don't get what this is supposed to be, what is this useful for?
okay! i see now: uptimerobot for scratch projects. this is so useful, project is on trending so i saw
Joshisaurio
Scratcher
100+ posts

Public CloudHead API Endpoints

silvxrcat wrote:

(#6)
i don't get what this is supposed to be, what is this useful for?
You need to use Python and Replit, the Replit IP's got banned, which could be annoying for Python coders trying to host their servers 24/7 (like me and 99.9% of the Python coders - one is an Scratch impostor trying to sneak like he knows Python) so this basically fixes that
silvxrcat
Scratcher
500+ posts

Public CloudHead API Endpoints

Joshisaurio wrote:

silvxrcat wrote:

(#6)
i don't get what this is supposed to be, what is this useful for?
You need to use Python and Replit, the Replit IP's got banned, which could be annoying for Python coders trying to host their servers 24/7 (like me and 99.9% of the Python coders - one is an Scratch impostor trying to sneak like he knows Python) so this basically fixes that
how does this fix that exactly? i do now understand what this is but how do i connect to my cloudhead monitor?

(also speaking of which I posted a question on the scratchattach forum about using proxies which might also solve the new uprising problem, but this might be easier and less risky then that…)

Last edited by silvxrcat (Aug. 25, 2022 01:23:49)

--_S_T_A_R_M_A_N_--
Scratcher
4 posts

Public CloudHead API Endpoints

i would personly just plug an old computer in with python on it and never close it
ZZC12345
Scratcher
500+ posts

Public CloudHead API Endpoints

--_S_T_A_R_M_A_N_-- wrote:

i would personly just plug an old computer in with python on it and never close it
I would too, but then you have to set up your own network to map to port 443 on that computer, and figure out DNS, etc. Too much work.
ScratchTheCoder12345
Scratcher
500+ posts

Public CloudHead API Endpoints

ZZC12345 wrote:

--_S_T_A_R_M_A_N_-- wrote:

i would personly just plug an old computer in with python on it and never close it
I would too, but then you have to set up your own network to map to port 443 on that computer, and figure out DNS, etc. Too much work.
Keep in mind it might not be able to handle all of the pings and network traffic from the code
ScratchTheCoder12345
Scratcher
500+ posts

Public CloudHead API Endpoints

TCTC112 wrote:

how are you running your python script 24/7? Before, I was using repl.it and uptimerobot, but since scratch banned repl.it, the script stops working once in a while, and completely erases all codes and what not saved in the array lists. Does this mean that you have another computer running 24/7, or are you using another way?
Add a flask server to the replit and then ping the flask server. Repls automatically go to sleep when there isn't HTTP traffic for a period of time.
Redstone1080
Scratcher
1000+ posts

Public CloudHead API Endpoints

TCTC112 wrote:

the script stops working once in a while, and completely erases all codes and what not saved in the array lists

<offtopic>

Quick tip:
Arrays for persistent data aren't great because their state resets when the program restarts.
Instead, use JSON files or something similar (but JSON is very easy to handle). Python provides a library for dealing with JSON files, just import json at the top of your code and you can access a powerful library which you can use to interact with JSON files.

</offtopic>
Air_heads
Scratcher
98 posts

Public CloudHead API Endpoints

Dinosu wrote:

TCTC112 wrote:

how are you running your python script 24/7? Before, I was using repl.it and uptimerobot, but since scratch banned repl.it, the script stops working once in a while, and completely erases all codes and what not saved in the array lists. Does this mean that you have another computer running 24/7, or are you using another way?

I'm using Replit's cycles in order to keep my pinging program running

Dinosu wrote:

infintyrussia wrote:

Very cool, but will the backend ever overload pinging this many projects? Like I am using 1 server that handles multiple scratch projects and if I add over 10 it may become a bit delayed.

Thanks

It will take a very long time before the server becomes incapable because the backend uses threading to ping many, many monitors at once.

I can make it optimized if you would like . . .
Dinosu
Scratcher
82 posts

Public CloudHead API Endpoints

Air_heads wrote:

I can make it optimized if you would like . . .

It's okay, I'll be able to fix it easily if it ever reaches the limit; I just put that off for now because I haven't needed it yet and probably never will.
Ellirio2
Scratcher
30 posts

Public CloudHead API Endpoints

YO! Quick question will you just have to put the link to the replit repl or is server different bcs i want my repl to run forever so do i just put the link of the project
Alfa_Games
Scratcher
4 posts

Public CloudHead API Endpoints

Could you tell us how you created this cool project?
justablock
Scratcher
17 posts

Public CloudHead API Endpoints

so @Dinosu when it will be back

Powered by DjangoBB