Scratch API Interface
Clone or download
Latest commit 6920af6 Oct 1, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Fixed a bug, added a new feature Mar 8, 2016
README.md Update README.md Apr 9, 2016
README.rst Add PyPi support Feb 10, 2016
scratchapi.py oops Oct 1, 2016
setup.py Update setup.py Mar 2, 2016

README.md

scratchapi

scratchapi is a web API interface for Scratch, written in Python.

To get started, install it via pip by running pip install scratchapi
Alternatively, you can download this repository and run python setup.py install

Getting Started

To use the api, you must log in to your scratch account:

import scratchapi
scratch = scratchapi.ScratchUserSession('Username', 'password')

After login

Now, you can verify your session to see if you logged in correctly:

scratch.tools.verify_session() # Should return True

There are a lot of things you can you when you're logged in!

Take ownership of a new project:

scratch.lib.utils.request(path='/internalapi/project/new/set/?v=v442&title=Project', server=scratch.PROJECTS_SERVER, method='POST', payload={})

Follow Someone:

scratch.users.follow('Bob')

Set a cloud variable:

s.cloud.set_var('Variable', 12345, 4453648)

Documentation

I apologize for a lack of documentation at this very moment, some is on the way, and some is already located on scratchapi's wiki.

Credits

Some of the cloud data interface information was acquired from various topics on the Scratch Forums.

Certain code snips were based off scratch-api, by Truman Kilen.

TheLogFather helped out with various wrappers and conveniences for cloud data.

If you're using scratchapi for your project, I'd appreciate if you would give credit to me and my scratch account, @Dylan5797.