Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
wait does it actually mention the user? so he gets a notification?I'll look into it, maybe the reply_comment function doesn't work anymore
Thanks for replying! Here are some information that may help you…
1) I tried to reply with user.post_comment(“comment content”, parent_id=“id of the comment to reply to”, commentee_id=“”) but it didn't work…
2) I can “reply” using user.post_comment(f“@{name of the user to reply to} comment content”, parent_id=“”, commentee_id=“”). The message will not appear as a reply (below the original comment), but the user is mentioned in it and will be notified
Btw: I looked at the source code… I didn't think it was that big! I vaguely understood which parts made which requests to the Scratch servers. Congratulations again, this is the most competent python API for Scratch that I know of!
- MonkeyBean2
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Yep.wait does it actually mention the user? so he gets a notification?I'll look into it, maybe the reply_comment function doesn't work anymore
Thanks for replying! Here are some information that may help you…
1) I tried to reply with user.post_comment(“comment content”, parent_id=“id of the comment to reply to”, commentee_id=“”) but it didn't work…
2) I can “reply” using user.post_comment(f“@{name of the user to reply to} comment content”, parent_id=“”, commentee_id=“”). The message will not appear as a reply (below the original comment), but the user is mentioned in it and will be notified
Btw: I looked at the source code… I didn't think it was that big! I vaguely understood which parts made which requests to the Scratch servers. Congratulations again, this is the most competent python API for Scratch that I know of!
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Update v1.0.5
Updating is highly recommended
Bug fixes:
- Cloud requests: “ignore exceptions” was broken - it's fixed now
- Cloud requests: CPU usage decreased
Updating is highly recommended
Bug fixes:
- Cloud requests: “ignore exceptions” was broken - it's fixed now
- Cloud requests: CPU usage decreased
Last edited by TimMcCool (Sept. 16, 2022 20:55:41)
Developer of scratchattach, the most popular Python Scratch API wrapper
- NashwanYT
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
ok so is there any vid u can use to learn or do u have to learn it here or the PyPI functions?
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
well the documentation on the github and pipy is there, but no video ok so is there any vid u can use to learn or do u have to learn it here or the PyPI functions?
- ZZC12345
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
222584202 isn't a valid project id. Sorry, that's a comment id. Can you check that it still is there on the website?you are replacing PRIVATE with a valid sessionid?All of these features were tested and work. Are you getting any errors/warnings? Can we see your code? Not all features I bet, I can't comment or reply or follow or unfollow or change the desc of studio or change the title of the studio or change the title of a project or change the instructions and notes of a project and etc.
P.S. I ain't using replit to test these I use VSCode
Yes, certainlyimport os #os.system("pip install -U scratchattach") import scratchattach as scratch3 session = scratch3.Session("PRIVATE", username="Mast_Scratch") user = scratch3.get_user('Mast_Scratch') user.reply_comment("TEST", parent_id="222584202") project = scratch3.get_project("724856203") project.download(filename="project_name.sb3", dir="/") studio = session.connect_studio("30212213") studio.follow()
You are joking right!? Am I foolish enough to NOT write a valid session ID?! << instead of this long msg, YES
Last edited by ZZC12345 (Sept. 19, 2022 09:25:46)
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
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
one problem might possibly be, that user = scratch3.get_user() doesnt set your user, you should use something like session.set_user or however is in the docsyou are replacing PRIVATE with a valid sessionid?All of these features were tested and work. Are you getting any errors/warnings? Can we see your code? Not all features I bet, I can't comment or reply or follow or unfollow or change the desc of studio or change the title of the studio or change the title of a project or change the instructions and notes of a project and etc.
P.S. I ain't using replit to test these I use VSCode
Yes, certainlyimport os #os.system("pip install -U scratchattach") import scratchattach as scratch3 session = scratch3.Session("PRIVATE", username="Mast_Scratch") user = scratch3.get_user('Mast_Scratch') user.reply_comment("TEST", parent_id="222584202") project = scratch3.get_project("724856203") project.download(filename="project_name.sb3", dir="/") studio = session.connect_studio("30212213") studio.follow()
You are joking right!? Am I foolish enough to NOT write a valid session ID?! << instead of this long msg, YES
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
]
one problem might possibly be, that user = scratch3.get_user() doesnt set your user, you should use something like session.set_user or however is in the docs
Yep, that's why it's not working I think. Use session.connect_user(“username”), not scratch3.get_user(“username”)
It's documented here: https://github.com/TimMcCool/scratchattach/wiki#users
Last edited by TimMcCool (Sept. 20, 2022 22:35:25)
Developer of scratchattach, the most popular Python Scratch API wrapper
- B0yfr1end
- Scratcher
15 posts
scratchattach - A Scratch API wrapper (Python)
I LOVE PROTOGeNS AND I HATE PYTHONwho asked
Select some text, then press SHIFT + Down/Up arrow keys to view more of my siggy!
when green flag clicked
forever
imagine :: #0037ff
program :: #ff00c3
share :: #07ba04
rap battle :: #000000
end
<:)>Above is bill. He protects my siggy from kumquats!
- B0yfr1end
- Scratcher
15 posts
scratchattach - A Scratch API wrapper (Python)
How do I use scratchattack if the project cant be accessed?
Last edited by B0yfr1end (Sept. 21, 2022 23:59:06)
Select some text, then press SHIFT + Down/Up arrow keys to view more of my siggy!
when green flag clicked
forever
imagine :: #0037ff
program :: #ff00c3
share :: #07ba04
rap battle :: #000000
end
<:)>Above is bill. He protects my siggy from kumquats!
- Redstone1080
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
Anyone here use Python as their main coding language? Python is mine and I love it but I'm wondering if there is a better language out there. I know people are going to say well there is no one best coding language and I agree to this. The best coding language is one that has documentation lol.
I've given this question its own topic here: [Link to topic]
const juniper = programmer && musician; // my pronouns are she/her // i am trans and bi :P // you can call me june or juni for short but i prefer juniper
juniper = programmer and musician # my pronouns are she/her # i am trans and bi :P # you can call me june or juni for short but i prefer juniper
- DifferentDance8
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
No one did. However…I LOVE PROTOGeNS AND I HATE PYTHONwho asked
R.I.P Zydrolic, 2023-2024
- Mast_Scratch
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
]
one problem might possibly be, that user = scratch3.get_user() doesnt set your user, you should use something like session.set_user or however is in the docs
Yep, that's why it's not working I think. Use session.connect_user(“username”), not scratch3.get_user(“username”)
It's documented here: https://github.com/TimMcCool/scratchattach/wiki#users
tysm tysm tysm I am gonna test it
- Mast_Scratch
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
]
one problem might possibly be, that user = scratch3.get_user() doesnt set your user, you should use something like session.set_user or however is in the docs
Yep, that's why it's not working I think. Use session.connect_user(“username”), not scratch3.get_user(“username”)
It's documented here: https://github.com/TimMcCool/scratchattach/wiki#users
umm am I missing a line of code or smth?? cuz umm it doesn't work, sorry if I am being annoying.
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
]
one problem might possibly be, that user = scratch3.get_user() doesnt set your user, you should use something like session.set_user or however is in the docs
Yep, that's why it's not working I think. Use session.connect_user(“username”), not scratch3.get_user(“username”)
It's documented here: https://github.com/TimMcCool/scratchattach/wiki#users
umm am I missing a line of code or smth?? cuz umm it doesn't work, sorry if I am being annoying.
Your code should look like this
import scratchattach as scratch3 import os session = scratch3.Session(os.environ["session"]) user = session.connect_user("user") #the user profile you want to comment on user.post_comment("Hi!) user.follow()
you can also use
session = scratch3.login("username", "password")
Last edited by TimMcCool (Sept. 23, 2022 05:31:19)
Developer of scratchattach, the most popular Python Scratch API wrapper
- Mast_Scratch
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
]
one problem might possibly be, that user = scratch3.get_user() doesnt set your user, you should use something like session.set_user or however is in the docs
Yep, that's why it's not working I think. Use session.connect_user(“username”), not scratch3.get_user(“username”)
It's documented here: https://github.com/TimMcCool/scratchattach/wiki#users
umm am I missing a line of code or smth?? cuz umm it doesn't work, sorry if I am being annoying.
Your code should look like thisimport scratchattach as scratch3 import os session = scratch3.Session(os.environ["session"]) user = session.connect_user("user") #the user profile you want to comment on user.post_comment("Hi!) user.follow()
you can also useinstead of session = scratch3.Session(os.environ), maybe that works for yousession = scratch3.login("username", "password")
yes!!! it works 100% I need to sign in tho it works tysm!!!!!!! 1 last thing then you can forget about this problem, is there any possible way I could reply to a comment? if so can you share the code?
EDIT : something happened when I posted this. It showed I was forbidden and 403, though I went back and posted
Another Edit : YES!! I AM A GENIOUS, FORGET ABOUT MY TOPIC!!!
Last Edit : Is there any possible way to find parent id of a comment with code??? python code specifically or any other code, that could be connected to python… just that 1 last question.
Last edited by Mast_Scratch (Sept. 23, 2022 13:53:18)
- Turtsles
- Scratcher
58 posts
scratchattach - A Scratch API wrapper (Python)
can you use scratchattach to edit a projects json? for example i press a button on the main project and it sends a ping to my scratchattach which edits the projects json so when i refresh the page it is a different thing
when green flag clicked
say [Kumquats are nice] for (2) secs
They don't eat signatures! Just relaxxxx
or maybe they will destroy all of scratch >
- MonkeyBean2
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Umm, not sure, but it's pretty easy to do, just send a POST request to projects.scratch.mit.edu/<ID> can you use scratchattach to edit a projects json? for example i press a button on the main project and it sends a ping to my scratchattach which edits the projects json so when i refresh the page it is a different thing