Discuss Scratch

hubblefam
Scratcher
45 posts

scratchattach - A Scratch API wrapper (Python)

for some reason user.reply_comment() is broken i think.
code:
print('importing')
import scratchattach as scratch3
from keep_alive import keep_alive
import os
print('logging in')

session = scratch3.login("hubblescript", os.environ['password'])
print('complete.\n')

user = scratch3.get_user("hubblefam")

while True:
usercomments = user.comments(limit=20, page=1)

for comment in usercomments:

if comment['Content'][0] == '!':

command = comment['Content'][1:]

if not comment['hasReplies?']:

print(command)
user.reply_comment(command, parent_id=comment['CommentID'])

when i run it, it does not have any errors it just doesn't reply to the comment

Last edited by hubblefam (June 1, 2022 19:54:18)

Nigthmare_27
Scratcher
37 posts

scratchattach - A Scratch API wrapper (Python)

I think there's a bug in scratchattach, with Cloud requests: when I try to return a value 9600 characters long, it says that it will take >4 seconds, ok. But then it doesn't return all the data, the end is sometimes “forgot” (only 8700 chars are returned, or more that depends), and that's not because of a Timeout Error.

Last edited by Nigthmare_27 (June 1, 2022 20:20:25)

TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

hubblefam wrote:

for some reason user.reply_comment() is broken i think.
code:
print('importing')
import scratchattach as scratch3
from keep_alive import keep_alive
import os
print('logging in')

session = scratch3.login("hubblescript", os.environ['password'])
print('complete.\n')

user = scratch3.get_user("hubblefam")

while True:
usercomments = user.comments(limit=20, page=1)

for comment in usercomments:

if comment['Content'][0] == '!':

command = comment['Content'][1:]

if not comment['hasReplies?']:

print(command)
user.reply_comment(command, parent_id=comment['CommentID'])

when i run it, it does not have any errors it just doesn't reply to the comment

You have to put “user = session.connect_user('hubblefam')” in your code, not
“user = scratch3.get_user(”hubblefam“)”.

If you use the “get_user” function, it will fetch the user but won't save your session in the User object, therefore all functions that require authentification won't work. I probably should have mentioned that in the documentation. The “get_user” function was made for getting users without logging in.

Last edited by TimMcCool (June 1, 2022 20:47:45)


Developer of scratchattach, the most popular Python Scratch API wrapper
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Nigthmare_27 wrote:

I think there's a bug in scratchattach, with Cloud requests: when I try to return a value 9600 characters long, it says that it will take >4 seconds, ok. But then it doesn't return all the data, the end is sometimes “forgot” (only 8700 chars are returned, or more that depends), and that's not because of a Timeout Error.
There can be some packet loss when sending big responses. That's why it is recommended to keep response data smaller than 3000 characters.

Developer of scratchattach, the most popular Python Scratch API wrapper
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

SubscribeToZadpi wrote:

bruh doesn't work
<touching [ working thing] ?>
say [happy]
what doesn't work?

Developer of scratchattach, the most popular Python Scratch API wrapper
fluo1234
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

i dont think scratch attach exist in replit yet ):

do you need he- nvm

I wrote:

ok
something
fluo1234
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

wait is it just called scratch 3 now? because when i checked the packages it said there was a package named scratch 3 which said it was made by you


do you need he- nvm

I wrote:

ok
something
fluo1234
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

wait it works

Last edited by fluo1234 (June 2, 2022 02:10:48)


do you need he- nvm

I wrote:

ok
something
Nigthmare_27
Scratcher
37 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

Nigthmare_27 wrote:

I think there's a bug in scratchattach, with Cloud requests: when I try to return a value 9600 characters long, it says that it will take >4 seconds, ok. But then it doesn't return all the data, the end is sometimes “forgot” (only 8700 chars are returned, or more that depends), and that's not because of a Timeout Error.
There can be some packet loss when sending big responses. That's why it is recommended to keep response data smaller than 3000 characters.
Ok, but it's impossible for you to fix it ?
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Nigthmare_27 wrote:

TimMcCool wrote:

Nigthmare_27 wrote:

I think there's a bug in scratchattach, with Cloud requests: when I try to return a value 9600 characters long, it says that it will take >4 seconds, ok. But then it doesn't return all the data, the end is sometimes “forgot” (only 8700 chars are returned, or more that depends), and that's not because of a Timeout Error.
There can be some packet loss when sending big responses. That's why it is recommended to keep response data smaller than 3000 characters.
Ok, but it's impossible for you to fix it ?
Maybe the error occured because you switched browser tabs. The tab with the Scratch project has to be opened while it receives the response data, or else it will miss some packages.
However it could also be because of your internet connection. If this is the case, there's no way to fix the problem

Last edited by TimMcCool (June 2, 2022 13:31:52)


Developer of scratchattach, the most popular Python Scratch API wrapper
hubblefam
Scratcher
45 posts

scratchattach - A Scratch API wrapper (Python)

how do i set cloud variables to a negative number? every time i try, it says “invalid cloud var (not numeric): -995”
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

hubblefam wrote:

how do i set cloud variables to a negative number? every time i try, it says “invalid cloud var (not numeric): -995”
That bug was fixed in a newer version. Update scratchattach using “pip install scratchattach –upgrade”.

Developer of scratchattach, the most popular Python Scratch API wrapper
natman564
Scratcher
6 posts

scratchattach - A Scratch API wrapper (Python)

if (hungry?) then
eat tacos

Last edited by natman564 (June 2, 2022 21:48:27)

natman564
Scratcher
6 posts

scratchattach - A Scratch API wrapper (Python)

when green flag clicked
say [TACOS!!!]

Last edited by natman564 (June 2, 2022 21:49:16)

MooMoo5678star
Scratcher
39 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

hubblefam wrote:

how do i set cloud variables to a negative number? every time i try, it says “invalid cloud var (not numeric): -995”
That bug was fixed in a newer version. Update scratchattach using “pip install scratchattach –upgrade”.


hi!

my main profile:@MooMoo5678star




when green flag clicked
say (cool)
sorehaikenaine
Scratcher
69 posts

scratchattach - A Scratch API wrapper (Python)

hello!

Last edited by sorehaikenaine (June 2, 2022 22:18:31)


youtubeやってます。チャンネル登録してくれたら嬉しいです
僕のおすすめ作品はこれです!
私のプロジェクト宣伝場所!
。゚.o。(σ◕‿◕)σ【よろしくね~!】
sorehaikenaine
Scratcher
69 posts

scratchattach - A Scratch API wrapper (Python)

How can @TimMcCool save and share large amounts of scratch data?
In my case, I can't save a project in about 700 blocks. How can I save and share a large amount of data?

Last edited by sorehaikenaine (June 2, 2022 22:19:50)


youtubeやってます。チャンネル登録してくれたら嬉しいです
僕のおすすめ作品はこれです!
私のプロジェクト宣伝場所!
。゚.o。(σ◕‿◕)σ【よろしくね~!】
sorehaikenaine
Scratcher
69 posts

scratchattach - A Scratch API wrapper (Python)

when green flag clicked
say [How can I save a large amount of data?]

youtubeやってます。チャンネル登録してくれたら嬉しいです
僕のおすすめ作品はこれです!
私のプロジェクト宣伝場所!
。゚.o。(σ◕‿◕)σ【よろしくね~!】
fluo1234
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

sorehaikenaine wrote:

How can @TimMcCool save and share large amounts of scratch data?
In my case, I can't save a project in about 700 blocks. How can I save and share a large amount of data?
i think thats just scratch and you're just hitting the json limit

do you need he- nvm

I wrote:

ok
something
MooMoo5678star
Scratcher
39 posts

scratchattach - A Scratch API wrapper (Python)

sorehaikenaine wrote:

hello!


when green flag clicked
say [:)] for (2) secs
change [your followers v] by (1)

my main profile:@MooMoo5678star




when green flag clicked
say (cool)

Powered by DjangoBB