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

Import scratch2py in like this:

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

Usage

How to use S2py

Projects

Using the module for projects

s2py.getStats('id', 'stat')
# Gets the stats of a project. First input is the project ID, the second one is what stat you want (Loves, faves, views or remixes)
s2py.getProjectComments('id')
# Gets the comments of a project based on the project ID. Data returned in JSON.
s2py.shareProject('pid')
# Shares a project based on the project ID.
s2py.unshareProject('pid')
# Unshares a projec based on the project ID.

Studios

Using the module for a studio

s2py.getStudioComments('id')
# Gets the comments of a studio based on the ID.
s2py.postStudioComments('studio id','content','parent id','commentee id')
# Posts a comment on a studio. (See s2py.postProjectComments for param ^)
s2py.followStudio('studio id')
# Follows a studio based on the ID.
s2py.unfollowStudio('Studio id')
# Unfollows a studio based on the ID.
s2py.inviteCurator('studio id','username')
# Invites someone to a studio.

User

Using the module for getting user data

s2py.getUserStatus('user')
# Gets the 'about me' section of a users.
s2py.getUserBio('user')
# Gets the 'What I'm Working On' section of a users profile.
s2py.getUserMessagesCount('user')
# Gets the number of messages someone has.
s2py.checkUserExists('user')
# Checks if a user exists. Returns true or false
s2py.love('project id')
# Loves a project based on the ID.
s2py.unlove('project id')
# Unloves a project based on the ID.
s2py.favorite('project id')
# Favorites a project based on the ID.
s2py.unfavorite('project id')
# Unfavorites a project based on the ID.
s2py.followUser('name')
# Follows a user based on the username.
s2py.unfollowUser('name')
# Unfollows a user based on the username.
s2py.toggleCommenting()
# Toggles comments for your profile.
s2py.getMessages()
# Gets your messages and returns the JSON.

Forums

s2py.followPost(postid)
# Follows a post based on the post ID.
s2py.unfollowPost(postid)
# Unfollows a post based on the post ID.

Cloud

Using the module for cloud.

s2py.cloudConnect('Project ID')
# Starts a cloud connection to a specific project
s2py.setCloudVar('CloudVar', 'Value')
# Sets a value to a cloud variable. Don't add the cloud symbol.
s2py.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.
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

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.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

scratch2py-0.3.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scratch2py-0.3.0.tar.gz
  • Upload date:
  • Size: 6.9 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.0.tar.gz
Algorithm Hash digest
SHA256 e8e25d7b4140756dbcbd6b1fc1aa9e97413647c02c69cb09354053710cf04e2c
MD5 03b2c2910778a25ba2dd22547311be28
BLAKE2b-256 07057cd90bc04d8bfbf87f587e866b3bcf86c20f28404886688679df62618a2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scratch2py-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2553c5f46710809674dec5f8e53ff83e51d8bcccbfc10ac367f07420beeb2999
MD5 8b4c9960d20b502b1e873f6b88568912
BLAKE2b-256 7e0205ef876aefc77adca2383fddd4313e8f016f0bc283c9ebe5ffa6e0faaee1

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