Discuss Scratch

Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

A few days ago I noticed there was no easy way to mess with scratch's API in Python so I created a python module to do this. https://pypi.org/project/scratchclient/

You can install it using
pip install scratchclient

Thanks to this npm package for the reference code and ilcheese2 for their modified version of my cloud code.

You can report issues on the github repo, this topic, or my scratch profile.

Usage:
Basic usage:
from scratchclient import ScratchSession
session = ScratchSession("ceebee", "--uwu--")
# post comments
session.get_user("Paddle2See").post_comment("OwO")
# lots of other stuff
print(session.get_project(450216269).get_comments()[0].content)
print(session.get_studio(29251822).description)
Cloud connection:
from scratchclient import ScratchSession
session = ScratchSession("griffpatch", "SecurePassword7")
connection = session.create_cloud_connection(450216269)
connection.set_cloud_variable("variable name", 5000)
@connection.on("set")
def on_set(variable):
    print(variable.name, variable.value)
print(connection.get_cloud_variable("other variable"))

I havent made documentation yet because I'm lazy so feel free to ask questions in this topic.

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










scratchieguy12345678
Scratcher
500+ posts

scratchclient - A scratch API wrapper for python

That looks really cool! I'm going to have to try that out!

9gr
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

make bbcode reading possible and ill be happy

moved to @verixion
Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

9gr wrote:

make bbcode reading possible and ill be happy
What do you mean?

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










Chiroyce
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

What do you mean?
basically it takes raw BBCODE data from the api like this

 [color=red] nono word [/color]
and will show it like this
nono word

Last edited by Chiroyce (April 22, 2021 09:15:25)


| Boy | 13 | Python | ATer |  Tech | Cars | Procrastinator | Forums | Cricket | ☁️ Cloud |

5fdb2e83ca5a134289edeb294044abb23578eeb6d0d851cca9dd976b38ec6508


I FOUND IT!!! https://scratch.mit.edu/adminpanel/adminpanel.png


Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Chiroyce wrote:

Raihan142857 wrote:

What do you mean?
basically it takes raw BBCODE data from the api like this

 [color=red] nono word [/color]
and will show it like this
nono word
There's no API for the forums… I guess I can implement ScratchDB but that sort of defeats the purpose…

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










Chiroyce
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

There's no API for the forums…
what I meant was getting posts using a get request

| Boy | 13 | Python | ATer |  Tech | Cars | Procrastinator | Forums | Cricket | ☁️ Cloud |

5fdb2e83ca5a134289edeb294044abb23578eeb6d0d851cca9dd976b38ec6508


I FOUND IT!!! https://scratch.mit.edu/adminpanel/adminpanel.png


acted
New to Scratch
1 post

scratchclient - A scratch API wrapper for python

Last edited by acted (April 22, 2021 16:54:26)

Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Chiroyce wrote:

Raihan142857 wrote:

There's no API for the forums…
what I meant was getting posts using a get request
You mean webscraping?

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










9gr
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

Chiroyce wrote:

Raihan142857 wrote:

There's no API for the forums…
what I meant was getting posts using a get request
You mean webscraping?
no
GET scratch.mit.edu/discuss/post/postid/source

moved to @verixion
Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

9gr wrote:

Raihan142857 wrote:

Chiroyce wrote:

Raihan142857 wrote:

There's no API for the forums…
what I meant was getting posts using a get request
You mean webscraping?
no
GET scratch.mit.edu/discuss/post/postid/source
Oop, apparently I was wrong. I'll add it the next time I update it.

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










PikachuB2005
Scratcher
100+ posts

scratchclient - A scratch API wrapper for python

@Raihan142857 Can you include a list of ALL of the functions?

BTW I have my own github repo for interacting with scratch's api, but I would like to try yours. I made this thing with mine.

Working on a scratch to pygame converter!
Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

PikachuB2005 wrote:

@Raihan142857 Can you include a list of ALL of the functions?

BTW I have my own github repo for interacting with scratch's api, but I would like to try yours. I made this thing with mine.
I'm going to add documentation later.

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










9gr
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

PikachuB2005 wrote:

@Raihan142857 Can you include a list of ALL of the functions?

BTW I have my own github repo for interacting with scratch's api, but I would like to try yours. I made this thing with mine.
I'm going to add documentation later.
Imma use your code for the new api docs I'm making

moved to @verixion
Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

bump

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

is anyone willing to help me write docs? there's a lot of stuff I need to document and help would be appreciated

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










silvxrcat
Scratcher
100+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

is anyone willing to help me write docs? there's a lot of stuff I need to document and help would be appreciated
sure i'll help, i know basic md

scratchieguy12345678
Scratcher
500+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

is anyone willing to help me write docs? there's a lot of stuff I need to document and help would be appreciated

I'll help, I've already looked at the code and I understand it well.

9gr
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Raihan142857 wrote:

is anyone willing to help me write docs? there's a lot of stuff I need to document and help would be appreciated
mkdocs please

moved to @verixion
Raihan142857
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

9gr wrote:

Raihan142857 wrote:

is anyone willing to help me write docs? there's a lot of stuff I need to document and help would be appreciated
mkdocs please
I'm just gonna put it on the wiki for the gh repo

I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?










Powered by DjangoBB

Standard | Mobile