Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchclient - A scratch API wrapper for python
- jyotirmoy2020
- Scratcher
2 posts
scratchclient - A scratch API wrapper for python
what could be the problem then?i do not think so.hang on, does does the cloud variable need to start with the ☁ symbol? 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
I made a new script as a test and it gets stuck connecting to the project
this is the scriptprint("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
The code you have given here perfectly works!
- DifferentDance8
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
Like I just proved… The code you have given here perfectly works!
SOMEONE PLEASE HELP ME
- TimMcCool
- Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
what could be the problem then?i do not think so.hang on, does does the cloud variable need to start with the ☁ symbol? 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
I made a new script as a test and it gets stuck connecting to the project
this is the scriptprint("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
Are you running the code on replit? Then it won't work. Scratch blocked replit from sending login request.
To set cloud variables with replit, you have to use cookie connect. I'm not sure if scratchclient has that feature, I couldn't find it in the documentation
Developer of scratchattach, the most popular Python Scratch API wrapper
- TimMcCool
- Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
Ok, I just mainly want to see user followers and project stats and whatnot. How do I use the API?(#563)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.
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.
i've never used scratchclient before now lol
To get your user / project stats, use @DatOneLefty's ScratchDB API:
https://scratchdb.lefty.one/v3/docs/#api-User-GetUserInfo
Example: (this will fetch your user stats)
import requests stats = requests.get("https://scratchdb.lefty.one/v3/user/info/SomeoneOnThelnternet").json()
You can also get your user stats with scratchattach (doesn't require logging in) or scratchconnect:
import scratchattach as scratch3 user = scratch3.get_user("SomeoneOnTheInternet") stats = user.stats()
Last edited by TimMcCool (Aug. 31, 2022 10:45:49)
Developer of scratchattach, the most popular Python Scratch API wrapper
- DifferentDance8
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
I just made a script that follows and unfollows the account you choose to follow or unfollow.
So, if you wanted to follow gdpr0000001 using this script, you can!
from scratchclient import ScratchSession username2 = input("Username? ") password2 = input("Password? ") session = ScratchSession(username2, password2) follow_or_unfollow = input("Do you want to follow a user or unfollow a user? (\"y\" to follow, CASE SENSITIVE)") if follow_or_unfollow == "y": print("Follow option selected!") else: print("Unfollow option selected") print("Enter in a user name") user1 = input() if follow_or_unfollow == "y": print(f"Following user {user1}...") session.get_user(user1).follow() print(f"User {user1} followed! Check your followers page! https://scratch.mit.edu/users/{username2}/following/") print("To follow or unfollow another user, run this script again!") else: print(f"Unfollowing user {user1}") session.get_user(user1).unfollow() print(f"User {user1} followed! Check your followers page! https://scratch.mit.edu/users/{username2}/following/") print("To unfollow or follow another user, run this script again!")
So, if you wanted to follow gdpr0000001 using this script, you can!
SOMEONE PLEASE HELP ME
- completeness
- Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
You can use scratchclient for this now, I believe. ScratchSession doesn't require any parameters.Ok, I just mainly want to see user followers and project stats and whatnot. How do I use the API?(#563)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.
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.
i've never used scratchclient before now lol
To get your user / project stats, use @DatOneLefty's ScratchDB API:
https://scratchdb.lefty.one/v3/docs/#api-User-GetUserInfo
…
from scratchclient import ScratchSession session = ScratchSession() # User info print(session.get_user("griffpatch")) # Follower count print(session.scraping.get_follower_count("griffpatch"))
- Peterlll
- Scratcher
11 posts
scratchclient - A scratch API wrapper for python
Are you guys really sure this can be used without risking a ban?
- DifferentDance8
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
About as safe as using any other scratch python library! Are you guys really sure this can be used without risking a ban?
SOMEONE PLEASE HELP ME
- ZZC12345
- Scratcher
500+ posts
scratchclient - A scratch API wrapper for python
Yes. There are Are you guys really sure this can be used without risking a ban?so many cloud projects using this and similar libraries out there, and they're all still up.
This is my signature. Go check out my GitHub if you want to!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code! (outdated, sorry)
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp - My GitHub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code! (outdated, sorry)
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp - My GitHub
- god286
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
(#587)If you use social actions, like following, loving/favouriting, commenting, etc. then that is not allowed and you may be warned/banned.
Are you guys really sure this can be used without risking a ban?
Other than that, for just getting data and cloud variables, it should be safe.
Here are some of my followers!
I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
- DifferentDance8
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
…oh boy, time to edit my post to remove the script!(#587)If you use social actions, like following, loving/favouriting, commenting, etc. then that is not allowed and you may be warned/banned.
Are you guys really sure this can be used without risking a ban?
SOMEONE PLEASE HELP ME
- AdamKRPS425
- Scratcher
43 posts
scratchclient - A scratch API wrapper for python
I get this when posting the commentDo 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)? really I would appreciate any help
and when changing a cloud variable the project just hangs, the console stays responsive but nothing happens. through testing I figured it got stuck on
connection = session.create_cloud_connection(726701801)
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
nope, running it locallywhat could be the problem then?i do not think so.hang on, does does the cloud variable need to start with the ☁ symbol? 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
I made a new script as a test and it gets stuck connecting to the project
this is the scriptprint("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
Are you running the code on replit? Then it won't work. Scratch blocked replit from sending login request.
To set cloud variables with replit, you have to use cookie connect. I'm not sure if scratchclient has that feature, I couldn't find it in the documentation
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
does anyone have an idea as why it does not work for me? do I have to install something beside scrstchcliant? I run it in vs code do I need to run it directly in python? how long should it take?what could be the problem then?i do not think so.hang on, does does the cloud variable need to start with the ☁ symbol? 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
I made a new script as a test and it gets stuck connecting to the project
this is the scriptprint("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
The code you have given here perfectly works!
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!!!
- ZZC12345
- Scratcher
500+ posts
scratchclient - A scratch API wrapper for python
What's the error?does anyone have an idea as why it does not work for me? do I have to install something beside scrstchcliant? I run it in vs code do I need to run it directly in python? how long should it take? ~snip~
The code you have given here perfectly works!
This is my signature. Go check out my GitHub if you want to!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code! (outdated, sorry)
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp - My GitHub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code! (outdated, sorry)
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp - My GitHub
- DifferentDance8
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
What's the error?does anyone have an idea as why it does not work for me? do I have to install something beside scrstchcliant? I run it in vs code do I need to run it directly in python? how long should it take? ~snip~
The code you have given here perfectly works!
I get this when posting the comment
SOMEONE PLEASE HELP ME
- ZZC12345
- Scratcher
500+ posts
scratchclient - A scratch API wrapper for python
Sorry!What's the error?does anyone have an idea as why it does not work for me? do I have to install something beside scrstchcliant? I run it in vs code do I need to run it directly in python? how long should it take? ~snip~
The code you have given here perfectly works!I get this when posting the comment
Scratch returned a 403 error when you tried to post that comment. I'm not sure why.
https://github.com/CubeyTheCube/scratchclient/blob/cbabc79bbdeec1064e8de1c88480efdaebd5e1e7/scratchclient/User.py#L102-L103
This is my signature. Go check out my GitHub if you want to!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code! (outdated, sorry)
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp - My GitHub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code! (outdated, sorry)
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp - My GitHub
- NashwanYT
- Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
can u use pycharm it has inbuilt terminal and pip
- DifferentDance8
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
Most of us would rather can u use pycharm it has inbuilt terminal and pipnot pay 89 dollars USA for a product that can easily be replicated for 0 dollars USA with VSCode and a VSCode extension. Your choice, though.
SOMEONE PLEASE HELP ME
- Chiroyce
- Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
Bruh PyCharm is free https://www.jetbrains.com/pycharm/download/ — secondly if they already have the paid version then what is wrong with using PyCharm for this? PyCharm is designed for PythonMost of us would rather can u use pycharm it has inbuilt terminal and pipnot pay 89 dollars USA for a product that can easily be replicated for 0 dollars USA with VSCode and a VSCode extension. Your choice, though.
I've seen this as a trend with your posts, just take this as advise and maybe look through sources a bit more when you post
Last edited by Chiroyce (Sept. 17, 2022 05:09:55)
April Fools' topics:
— New Buildings in Scratch's headquarters
— Give every Scratcher an M1 MacBook Air
— Scratch should let users edit other Scratchers' projects
— Make a statue for Jeffalo
— Scratch Tech Tips™
— Make a Chiroyce statue emoji
<img src=“x” onerror=“alert('XSS vulnerability discovered')”>
this is a test sentence
- Discussion Forums
- » Advanced Topics
- » scratchclient - A scratch API wrapper for python