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 (email removed by moderator - please don't share contact information) 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.

Last edited by Paddle2See (Aug. 10, 2022 17:07:04)


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

@Weredime on GitHub for more epic 9gr content
not really active here anymore

say [Hello world!]
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)








April Fools' topics:
New Buildings in Scratch's headquarters
Give every Scratcher an M1 MacBook Air
Scratch should let users edit other Scratchers' projects
Make a statue for Jeffalo
Scratch Tech Tips™
Make a Chiroyce statue emoji


<img src=“x” onerror=“alert('XSS vulnerability discovered')”>

this is a test sentence
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







April Fools' topics:
New Buildings in Scratch's headquarters
Give every Scratcher an M1 MacBook Air
Scratch should let users edit other Scratchers' projects
Make a statue for Jeffalo
Scratch Tech Tips™
Make a Chiroyce statue emoji


<img src=“x” onerror=“alert('XSS vulnerability discovered')”>

this is a test sentence
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

@Weredime on GitHub for more epic 9gr content
not really active here anymore

say [Hello world!]
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

@Weredime on GitHub for more epic 9gr content
not really active here anymore

say [Hello world!]
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
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
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

@Weredime on GitHub for more epic 9gr content
not really active here anymore

say [Hello world!]
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?










Yeetoburro1
Scratcher
1000+ posts

scratchclient - A scratch API wrapper for python

Hi, for some reason connecting to a project is taking infinitely long for me, wondering if this is a common issue or..
edit: king of the page hahaaha

Last edited by Yeetoburro1 (May 19, 2021 03:56:24)


Powered by DjangoBB

Standard | Mobile