Skip to main content

Python to Scratch API connector

Project description

Scratch2py

Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of scratchclient by Raihan142857

Installation

Run this command in your terminal as ONE command.

pip install scratch2py && pip uninstall websocket-client & pip install websocket-client

Usage

Import scratch2py in like this:

import scratch2py
s2py = scratch2py.Scratch2Py('username', 'password')
# Imports s2py and initializes a new s2py object. Enter your Scratch MIT credentials to create a connection with the API.

user class

user = s2py.user('username')
user.exists()
# Checks if a user exists. Returns true or false
user.getMessagesCount()
# Gets the number of messages someone has.
user.getMessages()
# Gets your messages and returns the JSON.
user.getStatus()
# Gets the 'about me' section of a users.
user.getBio()
# Gets the 'What I'm Working On' section of a users profile.
user.getProjects()
# Gets the projects that a user has.

userSession class

user = s2py.userSession('username')

user.followUser('otheruser')
# Follows a user
user.unfollowUser('thatotheruser')
# Unfollows a user
user.toggleCommenting()
# Toggles commenting on your profile (On/Off)

studioSession class

studio = s2py.studioSession('sid')

studio.inviteCurator('person')
# Invites a curator to a studio
studio.addStudioProject('pid')
# Adds a project to a studio
studio.postComment('Text', 'parentid', 'commentee_id')

studio.getComments()
# Gets the comments from a studio
studio.follow()
# Follows a studio
studio.unfollow()
# Unfollows a studio

project class

project = s2py.project('id')

project.getStats('loves/faves/remixes/views')
# Gets the stats of a project
project.getComments()
# Gets the comments of a project
project.getInfo()
# Gets the info of a project

projectSession class

project = s2py.projectSession('id')
# Starts a project session to the specific project

project.share()
# Shares a project
project.unshare()
# Unshares a project
project.favorite()
# Favorites a project
project.unfavorite()
# Unfavorites a project
project.love()
# Loves a project
project.unlove()
# Unloves a project

cloud Class

Using the module for cloud.

cloudproject = s2py.cloud('Project ID')
# Starts a cloud connection to a specific project
cloudproject.setCloudVar('CloudVar', 'Value')
# Sets a value to a cloud variable. Don't add the cloud symbol.
cloudproject.readCloudVar('variable name', 'Limit(optional)')
# Gets the value of a cloud variable. Limit is when the program should stop looking for the value. Limit is 1000 by default.

Turbowarp and encode/decode functions

s2py.encode('value')
# Encodes a value. Scratch version available on my Scratch profile
s2py.decode('value')
# Decodes a value. To be used to communicate to and from a Scratch project.
s2py.turbowarpConnect('pid')
# Connects to a turbowarp project
s2py.setTurbowarpVar('var','value')
# Changes the value of a turbowarp var.

The End

That's it! Contact my on my Scratch profile

Scratch2py

Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of scratchclient by Raihan142857

Installation

This command differs by system:

  • Windows : py -m pip install -r requirements.txt
  • Linux/Mac : pip3 install -r requirements.txt

Usage

Import scratch2py in like this:

import scratch2py
s2py = scratch2py.Scratch2Py('username', 'password')
# Imports s2py and initializes a new s2py object. Enter your Scratch MIT credentials to create a connection with the API.

user class

user = s2py.user('username')
user.exists()
# Checks if a user exists. Returns true or false
user.getMessagesCount()
# Gets the number of messages someone has.
user.getMessages()
# Gets your messages and returns the JSON.
user.getStatus()
# Gets the 'about me' section of a users.
user.getBio()
# Gets the 'What I'm Working On' section of a users profile.
user.getProjects()
# Gets the projects that a user has.

userSession class

user = s2py.userSession('username')

user.followUser('otheruser')
# Follows a user
user.unfollowUser('thatotheruser')
# Unfollows a user
user.toggleCommenting()
# Toggles commenting on your profile (On/Off)

studioSession class

studio = s2py.studioSession('sid')

studio.inviteCurator('person')
# Invites a curator to a studio
studio.addStudioProject('pid')
# Adds a project to a studio
studio.postComment('Text', 'parentid', 'commentee_id')

studio.getComments()
# Gets the comments from a studio
studio.follow()
# Follows a studio
studio.unfollow()
# Unfollows a studio

project class

project = s2py.project('id')

project.getStats('loves/faves/remixes/views')
# Gets the stats of a project
project.getComments()
# Gets the comments of a project
project.getInfo()
# Gets the info of a project

projectSession class

project = s2py.projectSession('id')

project.share()
project.unshare()
project.favorite()
project.unfavorite()
project.love()
project.unlove()

Cloud class

Using the module for cloud.

cloud = s2py.cloud('projectid')
cloud.setCloudVar('CloudVar', 'Value')
# Sets a value to a cloud variable. Don't add the cloud symbol.
cloud.readCloudVar('variable name', 'Limit(optional)')
# Gets the value of a cloud variable. Limit is when the program should stop looking for the value. Limit is 1000 by default.
cloud.encode('value')
# Encodes a value. Scratch version available on my Scratch profile
cloud.decode('value')
# Decodes a value. To be used to communicate to and from a Scratch project.
cloud.turbowarpConnect('pid')
# Connects to a turbowarp project
cloud.setTurbowarpVar('var','value')
# Changes the value of a turbowarp var.

The End

That's it! Contact my on my Scratch profile

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scratch2py-0.3.3.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

scratch2py-0.3.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file scratch2py-0.3.3.tar.gz.

File metadata

  • Download URL: scratch2py-0.3.3.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for scratch2py-0.3.3.tar.gz
Algorithm Hash digest
SHA256 963375f1415d4d9075d12c816645d9955e291182b00c1d164237b63483948544
MD5 d2f92346a03c845aeb40d663c877738c
BLAKE2b-256 c059890e86819f7290793524c5d3740fe17e991e3564e08f23f5a3303e3421b6

See more details on using hashes here.

File details

Details for the file scratch2py-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: scratch2py-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for scratch2py-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b2cd66f92558cb886ec1c35f20375d1bbca5ccab9d1b13b8c4e59d8db3266667
MD5 2311f5d0638468f10e5ab2170bd152e2
BLAKE2b-256 41e1763488b423d105b655adabdb5e923f755a121edf103c6c20d40e587f8d6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page