Discuss Scratch

Loganmcc04
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

SubscribeToZadpi wrote:

I don't know if i'm just stupid or something, but when I type pip install scratchattach to Python it says an error
Try running it in the shell. (Second tab of the window at the bottom right / right) Hopefully this fixes your problem.

Last edited by Loganmcc04 (June 1, 2022 08:15:11)




Albert Einstein wrote:

You should play GMOD Nextbots today!
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

New in v0.5.5:


- Getting and following Forum Topics (new scratch3.ForumTopic class)
- Getting list of the forum topics in a category
- Getting forum topic change log

- Getting and editing Forum Posts (new scratch3.ForumPost class)
- Getting forum posts of a topic
- Searching forum posts all over Scratch
- Getting the forum posts made by a user

- Getting a post's ocular reactions
- Getting a user's ocular status

- Getting site statistics (from https://scratch.mit.edu/statistics/)
- Getting site health

To prevent spam, adding posts to topics is not a scratchattach feature and never will be.

If you find any bugs in the new features, please report them.
ok
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper (Python)

MooMoo5678star wrote:

I m new here!
Hi! If you need help just create a post through here ya! thanks!
Loganmcc04
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

infintyrussia_test wrote:

I don't know what to do with this error:



Edit: works now.
Can you send us your code?
Hey, I have been trying to return multiple values from cloud requests too but it doesn't seem to work.
It looks like this.

Example:

return (argument1) - Username
return user.message_count - Message Count
return user.follower_count - Follower Count
return user.following_count - Following Count

Result:
error (could also return just (argument1) in scratch)

I also tried sending it in a big long string, but it just pasted into scratch as the actual functions names instead of what the functions contain.

Example:

name = (argument1)
message = user.message_count
follower = user.follower_count
following = user.following_count
return (argument1) + message + follower + following

Result in scratch:
(argument1) user.message_count user.follower_count user.following_count

I hope you can fix this..

Last edited by Loganmcc04 (June 1, 2022 09:06:42)




Albert Einstein wrote:

You should play GMOD Nextbots today!
infintyrussia_test
Scratcher
33 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

infintyrussia_test wrote:

I don't know what to do with this error:



Edit: works now.
Can you send us your code?
The problem was that I was setting a var to an image load and a string. If that makes sense.
xxxxxxx-70
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

hello

<<Xxxxxxx-70>>
______________________________________________________________ Oh hi there im xxxxxxx-70 an 16 year old i enjoy my life and it’s pretty chill I have accomplished many milestone and I’m happy to have them :) I also do a lot of art and very few codes if you want to support my alts check down here
Here are all my alts @Bluevubeman @nicescracher @the-guy-who-cares :D
by someone i dont know feel free to vistit my ◆-Profile-◆ page
by xxxxxxx-70
Ameise15
Scratcher
8 posts

scratchattach - A Scratch API wrapper (Python)

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Thanks in advance! Anyways, scratchattach ist awesome!

Last edited by Ameise15 (June 1, 2022 14:05:39)


when green flag clicked
forever
change [My followers v] by (1)
end
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Ameise15 wrote:

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Anyways, scratchattach ist awesome!
What error does it show? Thanks

Last edited by TimMcCool (June 1, 2022 13:51:21)


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

scratchattach - A Scratch API wrapper (Python)

Loganmcc04 wrote:

TimMcCool wrote:

infintyrussia_test wrote:

I don't know what to do with this error:



Edit: works now.
Can you send us your code?
Hey, I have been trying to return multiple values from cloud requests too but it doesn't seem to work.
It looks like this.

Example:

return (argument1) - Username
return user.message_count - Message Count
return user.follower_count - Follower Count
return user.following_count - Following Count

Result:
error (could also return just (argument1) in scratch)

I also tried sending it in a big long string, but it just pasted into scratch as the actual functions names instead of what the functions contain.

Example:

name = (argument1)
message = user.message_count
follower = user.follower_count
following = user.following_count
return (argument1) + message + follower + following

Result in scratch:
(argument1) user.message_count user.follower_count user.following_count

I hope you can fix this..

That's not a bug. “message_count()”, “follower_count()” and “following_count()” are functions, not attributes.
“user.message_count” will only reference the function. To get the user's message count, use "message = user.message_count()“.

”user.message_count()“ will return an integer while argument1 is a string. You can't add integers to string. Therefore ”return (argument1) + message + follower + following" won't work either. You could use an f-string to join the numbers and letters.

I fixed your code:
name = argument1
user = scratch3.get_user(name)
message = user.message_count()
follower = user.follower_count()
following = user.following_count()
return f"{argument1} {message} {follower} {following}"

Last edited by TimMcCool (June 1, 2022 14:04:23)


Developer of scratchattach, the most popular Python Scratch API wrapper
Ameise15
Scratcher
8 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

Ameise15 wrote:

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Anyways, scratchattach ist awesome!
What error does it show? Thanks

It's showing:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scratchattach/_cloud.py”, line 40, in _connect
self.websocket.connect(
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_core.py”, line 244, in connect
self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py”, line 136, in connect
sock = _ssl_socket(sock, options.sslopt, hostname)
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py”, line 272, in _ssl_socket
sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py”, line 248, in _wrap_sni_socket
return context.wrap_socket(
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py”, line 512, in wrap_socket
return self.sslsocket_class._create(
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py”, line 1070, in _create
self.do_handshake()
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py”, line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “cloud2.py”, line 4, in <module>
conn = session.connect_cloud(project_id=“698201759”)
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scratchattach/_session.py”, line 238, in connect_cloud
return _cloud.CloudConnection(username = self._username, session_id = self.session_id, project_id = int(project_id))
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scratchattach/_cloud.py”, line 17, in __init__
self._connect(cloud_host=cloud_host)
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scratchattach/_cloud.py”, line 47, in _connect
raise(_exceptions.ConnectionError)
scratchattach._exceptions.ConnectionError

Last edited by Ameise15 (June 1, 2022 15:19:54)


when green flag clicked
forever
change [My followers v] by (1)
end
SansStudios
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

Ameise15 wrote:

TimMcCool wrote:

Ameise15 wrote:

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Anyways, scratchattach ist awesome!
What error does it show? Thanks

It's showing:
ssl.SSLCertVerificationError: certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

scratchattach._exceptions.ConnectionError

To get certificates, you need to go to `/Applications/Python 3.x/` and open the `Install Certificates.command` file.

Also, your computer's name is included in the traceback—you might want to remove that.

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
xxxxxxx-70
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

when green flag clicked
change [ ] by (10000000000000000000000000000)

<<Xxxxxxx-70>>
______________________________________________________________ Oh hi there im xxxxxxx-70 an 16 year old i enjoy my life and it’s pretty chill I have accomplished many milestone and I’m happy to have them :) I also do a lot of art and very few codes if you want to support my alts check down here
Here are all my alts @Bluevubeman @nicescracher @the-guy-who-cares :D
by someone i dont know feel free to vistit my ◆-Profile-◆ page
by xxxxxxx-70
xxxxxxx-70
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

join me here follow me please…

<<Xxxxxxx-70>>
______________________________________________________________ Oh hi there im xxxxxxx-70 an 16 year old i enjoy my life and it’s pretty chill I have accomplished many milestone and I’m happy to have them :) I also do a lot of art and very few codes if you want to support my alts check down here
Here are all my alts @Bluevubeman @nicescracher @the-guy-who-cares :D
by someone i dont know feel free to vistit my ◆-Profile-◆ page
by xxxxxxx-70
Ameise15
Scratcher
8 posts

scratchattach - A Scratch API wrapper (Python)

SansStudios wrote:

Ameise15 wrote:

TimMcCool wrote:

Ameise15 wrote:

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Anyways, scratchattach ist awesome!
What error does it show? Thanks

It's showing:
ssl.SSLCertVerificationError: certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

scratchattach._exceptions.ConnectionError

To get certificates, you need to go to `/Applications/Python 3.x/` and open the `Install Certificates.command` file.

Also, your computer's name is included in the traceback—you might want to remove that.
Thanks alot. I just realized it's working perfectly when I do it on replit instead vs code (That was the only python editor I had)

when green flag clicked
forever
change [My followers v] by (1)
end
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Ameise15 wrote:

SansStudios wrote:

Ameise15 wrote:

TimMcCool wrote:

Ameise15 wrote:

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Anyways, scratchattach ist awesome!
What error does it show? Thanks

It's showing:
ssl.SSLCertVerificationError: certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

scratchattach._exceptions.ConnectionError

To get certificates, you need to go to `/Applications/Python 3.x/` and open the `Install Certificates.command` file.

Also, your computer's name is included in the traceback—you might want to remove that.
Thanks alot. I just realized it's working perfectly when I do it on replit instead vs code (That was the only python editor I had)
please differentiate. replit isnt an editor but an coding platform on its own with an own vm. i have absolutely no clue why youre certificate seems to be wrong, but thats not because of vscode
SubscribeToZadpi
Scratcher
20 posts

scratchattach - A Scratch API wrapper (Python)

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

Hello everyone!:)
Loganmcc04
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Thank you!

Last edited by Loganmcc04 (June 1, 2022 18:53:23)




Albert Einstein wrote:

You should play GMOD Nextbots today!
Ameise15
Scratcher
8 posts

scratchattach - A Scratch API wrapper (Python)

-FreeEngines- wrote:

Ameise15 wrote:

SansStudios wrote:

Ameise15 wrote:

TimMcCool wrote:

Ameise15 wrote:

Always when I try to connect to the cloud of a project it shows an error. Can anyone help me? Anyways, scratchattach ist awesome!
What error does it show? Thanks

It's showing:
ssl.SSLCertVerificationError: certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

scratchattach._exceptions.ConnectionError

To get certificates, you need to go to `/Applications/Python 3.x/` and open the `Install Certificates.command` file.

Also, your computer's name is included in the traceback—you might want to remove that.
Thanks alot. I just realized it's working perfectly when I do it on replit instead vs code (That was the only python editor I had)
please differentiate. replit isnt an editor but an coding platform on its own with an own vm. i have absolutely no clue why youre certificate seems to be wrong, but thats not because of vscode
OK but it's not bad because it's working now

when green flag clicked
forever
change [My followers v] by (1)
end
MooMoo5678star
Scratcher
39 posts

scratchattach - A Scratch API wrapper (Python)

hi
when green flag clicked
forever
say [hi]
end

my main profile:@MooMoo5678star




when green flag clicked
say (cool)
xxxxxxx-70
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

hello

<<Xxxxxxx-70>>
______________________________________________________________ Oh hi there im xxxxxxx-70 an 16 year old i enjoy my life and it’s pretty chill I have accomplished many milestone and I’m happy to have them :) I also do a lot of art and very few codes if you want to support my alts check down here
Here are all my alts @Bluevubeman @nicescracher @the-guy-who-cares :D
by someone i dont know feel free to vistit my ◆-Profile-◆ page
by xxxxxxx-70

Powered by DjangoBB