Discuss Scratch

MonkeyBean2
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

Mast_Scratch wrote:

I still don't understand one thing, what is parent id and comentee id? pls help and reply soon
parent_id is the id of the comment you are replying to. Idk about commentee_id either - the browser sends this field to the Scratch API so I implemented it, but I don't know what it does. Just leave out the argument (it's an optional argument. I added it so anyone who knows what commentee_id is can set it)

Commentee id can be (mis?)used to find an account with a peticular id


9NAwRfSR-%dWFS$a$g&zBMTj2?;jvS?L5%^X%qpCX|A<*paJ=lU07c)wmt$v{TxL5



-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

JloAu wrote:

TimMcCool wrote:

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!
wait does it actually mention the user? so he gets a notification?
MonkeyBean2
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

-FreeEngines- wrote:

JloAu wrote:

TimMcCool wrote:

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!
wait does it actually mention the user? so he gets a notification?
Yep.


9NAwRfSR-%dWFS$a$g&zBMTj2?;jvS?L5%^X%qpCX|A<*paJ=lU07c)wmt$v{TxL5



TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (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

Last edited by TimMcCool (Sept. 16, 2022 20:55:41)


My profile / Mein Profil: @TimMcCool
NashwanYT
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (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 | v1.0 released (Python)

NashwanYT wrote:

ok so is there any vid u can use to learn or do u have to learn it here or the PyPI functions?
well the documentation on the github and pipy is there, but no video
Mast_Scratch
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

#1203

Do I need to BUMP my topic or smth, I really need help!!!


ZZC12345
Scratcher
500+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Mast_Scratch wrote:

-FreeEngines- wrote:

Mast_Scratch wrote:

TimMcCool wrote:

Mast_Scratch wrote:

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
All of these features were tested and work. Are you getting any errors/warnings? Can we see your code?


Yes, certainly
import 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 replacing PRIVATE with a valid sessionid?


You are joking right!? Am I foolish enough to NOT write a valid session ID?! << instead of this long msg, YES
222584202 isn't a valid project id. Sorry, that's a comment id. Can you check that it still is there on the website?

Last edited by ZZC12345 (Sept. 19, 2022 09:25:46)


This is my signature. Contrary to popular belief, you do not need scratchblocks to protect against evil kumquats.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure to check out these cool projects, written in real code!
Aviate - Itinerary - Scratch Auth - Orange OS Linux Distro - ocular - Leopard - PyHelp
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Mast_Scratch wrote:

-FreeEngines- wrote:

Mast_Scratch wrote:

TimMcCool wrote:

Mast_Scratch wrote:

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
All of these features were tested and work. Are you getting any errors/warnings? Can we see your code?


Yes, certainly
import 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 replacing PRIVATE with a valid sessionid?


You are joking right!? Am I foolish enough to NOT write a valid session ID?! << instead of this long msg, YES
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
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

-FreeEngines- wrote:

]
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)


My profile / Mein Profil: @TimMcCool
B0yfr1end
Scratcher
9 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

scary- wrote:

I LOVE PROTOGeNS AND I HATE PYTHON
who asked

when green flag clicked
forever
imagine
program
share
rap battle
end
B0yfr1end
Scratcher
9 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

How do I use scratchattack if the project cant be accessed?

Last edited by B0yfr1end (Sept. 21, 2022 23:59:06)


when green flag clicked
forever
imagine
program
share
rap battle
end
Redstone1080
Scratcher
500+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchTheCoder12345 wrote:

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]

i use windows, btw
i use macos, btw
i use arch, btw
DifferentDance8
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

B0yfr1end wrote:

scary- wrote:

I LOVE PROTOGeNS AND I HATE PYTHON
who asked
No one did. However…

(removed by myself - this signature is far too long for any normal human being to read)

thirteenoclock wrote:

every 60 seconds, a minute passes. please fund my fight to slow time so we can prevent this. thank you
Mast_Scratch
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

-FreeEngines- wrote:

]
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


MonkeyBean2
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Last edited by MonkeyBean2 (Sept. 22, 2022 09:58:48)



9NAwRfSR-%dWFS$a$g&zBMTj2?;jvS?L5%^X%qpCX|A<*paJ=lU07c)wmt$v{TxL5



Mast_Scratch
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

-FreeEngines- wrote:

]
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 | v1.0 released (Python)

Mast_Scratch wrote:

TimMcCool wrote:

-FreeEngines- wrote:

]
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")
instead of session = scratch3.Session(os.environ), maybe that works for you

Last edited by TimMcCool (Sept. 23, 2022 05:31:19)


My profile / Mein Profil: @TimMcCool
Mast_Scratch
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

Mast_Scratch wrote:

TimMcCool wrote:

-FreeEngines- wrote:

]
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")
instead of session = scratch3.Session(os.environ), maybe that works for you


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
53 posts

scratchattach - A Scratch API wrapper | v1.0 released (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 >

Powered by DjangoBB

Standard | Mobile