Discuss Scratch

nini2009ph
Scratcher
87 posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

(#560)
can you tell me how you made this?

I am interested in making one to suit my needs
use websockets and connect to the scratch servers
SomeoneOnThelnternet
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Is it possible to add a session without my username and password? I want to use this to make a program but I don't want my password and stuff out there for anyone to see.

male | he/him or they/them | forumer (obviously) | PST | 2000+ posts | between 5 and 100 years old

Technoblade neva dies.

LINKS:

profile | 2000th post | scratching the surface six | more coming soon…

comment “bongis” on skadoodly's profile please
mrcoat
Scratcher
100+ posts

scratchclient - A scratch API wrapper for python

SomeoneOnThelnternet wrote:

(#563)
Is it possible to add a session without my username and password? I want to use this to make a program but I don't want my password and stuff out there for anyone to see.
Depending on what you want to do, if you just want to see user/project stats then you just use scratch's api. But there isn't really a way to comment and interact with the website without using your password.

My cartoon
Watch My Show!
I was gonna put an image of the studio but it didn't work.

Cool thing I made
when [Awesomeness v] > (100)
forever
play sound [Victory v] until done
set rotation style [The best style v]
go to [The party v]
end
SomeoneOnThelnternet
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

mrcoat wrote:

SomeoneOnThelnternet wrote:

(#563)
Is it possible to add a session without my username and password? I want to use this to make a program but I don't want my password and stuff out there for anyone to see.
Depending on what you want to do, if you just want to see user/project stats then you just use scratch's api. But there isn't really a way to comment and interact with the website without using your password.
Ok, I just mainly want to see user followers and project stats and whatnot. How do I use the API?

i've never used scratchclient before now lol

male | he/him or they/them | forumer (obviously) | PST | 2000+ posts | between 5 and 100 years old

Technoblade neva dies.

LINKS:

profile | 2000th post | scratching the surface six | more coming soon…

comment “bongis” on skadoodly's profile please
mbrick2
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

SomeoneOnThelnternet wrote:

Ok, I just mainly want to see user followers and project stats and whatnot. How do I use the API?

With python you do this

import requests
user = "chiroyce"
data = requests.get(f"https://api.scratch.mit.edu/users/{user}")

the data variable will have this JSON output
{
  "id": 58524660,
  "username": "Chiroyce",
  "scratchteam": false,
  "history": {
    "joined": "2020-03-25T08:04:04.000Z"
  },
  "profile": {
    "id": 57596999,
    "images": {
      "90x90": "https://cdn2.scratch.mit.edu/get_image/user/58524660_90x90.png?v=",
      "60x60": "https://cdn2.scratch.mit.edu/get_image/user/58524660_60x60.png?v=",
      "55x55": "https://cdn2.scratch.mit.edu/get_image/user/58524660_55x55.png?v=",
      "50x50": "https://cdn2.scratch.mit.edu/get_image/user/58524660_50x50.png?v=",
      "32x32": "https://cdn2.scratch.mit.edu/get_image/user/58524660_32x32.png?v="
    },
    "status": "A few things... \n\nAlso any comments talking about the troll asking people to report me WILL be deleted!!",
    "bio": "| Boy | 14 | Python | ATer |  Tech | Cars | \n| Cameras | Forums | Cricket | ☁️ Cloud |\n\n» Alt — @Chirover\n» PFP — @--Air--\n\nAlso no F4F or ads",
    "country": "India"
  }
}

or you can use ScratchConnect which has it premade








My Forums
ATs
Collabaration
My collabs
AIPoint
AspectOS
CoreOS
OddyseyOS
Cops and Robbers
#BringBackManagerRights
#ReturnRightsToManagers
#WeAreForManagerRights
#LetsRemindAboutMangers
#WeAreMangers
#MangersMustManage

The road to 1000 posts!
0 ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ 1000
80% complete

Banner Made By @Abcde26



Card Made By @Polygon
ajsya
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

SomeoneOnThelnternet wrote:

mrcoat wrote:

SomeoneOnThelnternet wrote:

(#563)
Is it possible to add a session without my username and password? I want to use this to make a program but I don't want my password and stuff out there for anyone to see.
Depending on what you want to do, if you just want to see user/project stats then you just use scratch's api. But there isn't really a way to comment and interact with the website without using your password.
Ok, I just mainly want to see user followers and project stats and whatnot. How do I use the API?

i've never used scratchclient before now lol
If you just want to use the Scratch API and good solution for you could be ScratchLink: https://github.com/Sid72020123/scratchlink

Feel free to message me on my profile if you need to tell me something/want someone to talk to.

Hi, I'm ajsya!

| GitHub | Wiki | My Posts |

Before creating a new topic on the forums search Ocular to see if one already exists!ˇ
Sid72020123
Scratcher
500+ posts

scratchclient - A scratch API wrapper for python

ajsya wrote:

SomeoneOnThelnternet wrote:

mrcoat wrote:

SomeoneOnThelnternet wrote:

(#563)
Is it possible to add a session without my username and password? I want to use this to make a program but I don't want my password and stuff out there for anyone to see.
Depending on what you want to do, if you just want to see user/project stats then you just use scratch's api. But there isn't really a way to comment and interact with the website without using your password.
Ok, I just mainly want to see user followers and project stats and whatnot. How do I use the API?

i've never used scratchclient before now lol
If you just want to use the Scratch API and good solution for you could be ScratchLink: https://github.com/Sid72020123/scratchlink
Or ScraGet: https://github.com/Quantum-Codes/ScraGet

Hello!
watchthepro
Scratcher
3 posts

scratchclient - A scratch API wrapper for python

how to send a variable to a python from scratch?
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

watchthepro wrote:

how to send a variable to a python from scratch?
I had this problem too. I can't get it to edit cloud variables even when signed in

Some help?

very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
completeness
Scratcher
100+ posts

scratchclient - A scratch API wrapper for python

Woah, some big changes happened.

Last edited by completeness (Aug. 10, 2022 16:45:00)

9gr
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

completeness wrote:

(#570)
Woah, some big changes happened.
Impossible since @Raihan142857 is banned RIP
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance

very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance
hang on, does does the cloud variable need to start with the ☁ symbol?

very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
DifferentDance8
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

AdamKRPS425 wrote:

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance
hang on, does does the cloud variable need to start with the ☁ symbol?
i do not think so.

SOMEONE PLEASE HELP ME
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

DifferentDance8 wrote:

AdamKRPS425 wrote:

AdamKRPS425 wrote:

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance
hang on, does does the cloud variable need to start with the ☁ symbol?
i do not think so.
what could be the problem then?

very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

DifferentDance8 wrote:

AdamKRPS425 wrote:

AdamKRPS425 wrote:

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance
hang on, does does the cloud variable need to start with the ☁ symbol?
i do not think so.
what could be the problem then?

I made a new script as a test and it gets stuck connecting to the project
this is the script
print("init")
from scratchclient import ScratchSession
print("logging on...")
session = ScratchSession("adamkrps425", "<placeholderpassword>")
print("connecting to project...")
connection = session.create_cloud_connection(726701801)
print("setting var...")
connection.set_cloud_variable("cloudVar", 1234)
print("done!")

and this is the console output

init
logging on…
connecting to project…
(still running as the posting of this btw its been like 5 min)


and as you see the cloud var on the project is still 0

Last edited by AdamKRPS425 (Aug. 31, 2022 09:48:44)


very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

AdamKRPS425 wrote:

DifferentDance8 wrote:

AdamKRPS425 wrote:

AdamKRPS425 wrote:

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance
hang on, does does the cloud variable need to start with the ☁ symbol?
i do not think so.
what could be the problem then?

I made a new script as a test and it gets stuck connecting to the project
this is the script
print("init")
from scratchclient import ScratchSession
print("logging on...")
session = ScratchSession("adamkrps425", "<placeholderpassword>")
print("connecting to project...")
connection = session.create_cloud_connection(726701801)
print("setting var...")
connection.set_cloud_variable("cloudVar", 1234)
print("done!")

and this is the console output

init
logging on…
connecting to project…
(still running as the posting of this btw its been like 5 min)


and as you see the cloud var on the project is still 0


and now why is this not working
print("logging on...")
session = ScratchSession("adamkrps425", "password")
session.get_user("adamkrps426").post_comment("test")


















sheesh nearly leaked my password! lol

very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
DifferentDance8
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

and this is the console output

init
logging on…
connecting to project…
(still running as the posting of this btw its been like 5 min)


and as you see the cloud var on the project is still 0
Well, for me, a modified version of the code works perfectly fine!

print("init")
from scratchclient import ScratchSession
print("logging on...")
session = ScratchSession("DifferentDance8", "https:/scratch.mit.edu/discuss/youtube/34Ig3X59_qA in order to get my password")
print("connecting to project...")
connection = session.create_cloud_connection(726705370)
print("setting var...")
connection.set_cloud_variable("cloud", 1)
print("done!")

And on the project, “cloud” is now “1” instead of “0”!

SOMEONE PLEASE HELP ME
AdamKRPS425
Scratcher
43 posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

AdamKRPS425 wrote:

AdamKRPS425 wrote:

DifferentDance8 wrote:

AdamKRPS425 wrote:

AdamKRPS425 wrote:

im having trouble with editing cloud variables in my project, I don't get an error and the script keeps running but the variable does not change on Scratch

it's in my account, the project is shared and I'm logged in on the API (ScratchSession(“admkrps425”, “ThisIsToatalyMyRealPasswordNoCap”)) and I don't know what to do.

any help please


thanks in advance
hang on, does does the cloud variable need to start with the ☁ symbol?
i do not think so.
what could be the problem then?

I made a new script as a test and it gets stuck connecting to the project
this is the script
print("init")
from scratchclient import ScratchSession
print("logging on...")
session = ScratchSession("adamkrps425", "<placeholderpassword>")
print("connecting to project...")
connection = session.create_cloud_connection(726701801)
print("setting var...")
connection.set_cloud_variable("cloudVar", 1234)
print("done!")

and this is the console output

init
logging on…
connecting to project…
(still running as the posting of this btw its been like 5 min)


and as you see the cloud var on the project is still 0


and now why is this not working
print("logging on...")
session = ScratchSession("adamkrps425", "password")
session.get_user("adamkrps426").post_comment("test")


















sheesh nearly leaked my password! lol
really I would appreciate any help

very unfortunately, my forum signature was eaten by an evil wizard and has now run away. please select this text and press ctrl+shift+down_key to view a animation




evil wizard code::events hat
forever
if <stolen forum signiture> then
laugh [he he he!] [quietly! v]
run!!!
end
end




















hi


hi!



hi!




————
| . . |
| ____ |
| / \|
————



————
| . . |
| ____ |
| |
————



————
| . . |
| \____/ |
| |
————





























































































you have reached the end of the animation.





























BYE!!!
DifferentDance8
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

AdamKRPS425 wrote:

really I would appreciate any help
Do you get a “scratchclient.ScratchExceptions.UnauthorizedException” error (meaning a 403, and I looked through the code), or a “scratchclient.ScratchExceptions.InvalidCredentialsException” error (meaning, well, your credentials are incorrect)?

SOMEONE PLEASE HELP ME

Powered by DjangoBB