Skip to content

Commit

Permalink
Some stuff I forgot
Browse files Browse the repository at this point in the history
  • Loading branch information
CubeyTheCube committed Aug 9, 2022
1 parent aa6a3a7 commit 0afbca2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
Binary file added docs/assets/session-id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

This is the documentation for scratchclient.

## Installation

Go to your terminal (not your python shell) and execute this command:
```bash
pip install scratchclient
```

If this didn't work for whatever reason, open your python shell and run the following:
```python
import os; os.system("pip install scratchclient")
```

scratchclient requires Python 3.7; however, it will work for almost all use cases on Python 3.6.

## Get Started
```python
from scratchclient import ScratchSession
Expand Down
27 changes: 27 additions & 0 deletions docs/replit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Usage on Replit

Scratch blocks most requests from the Replit, so you must work around it. To log into Scratch, instead of using your password, you can use your token and session ID.

You can obtain your session ID by [opening your browser developer tools](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools), going to Application > Storage (or just Storage), then finding "scratchsessionsid" and copying the cookie value.

![Getting the session ID from browser devtools](../assets/session-id.png)

You can obtain your token by running this in your browser console:
```js
alert(
document.getElementById('app')._reactRootContainer._internalRoot
.current.child.pendingProps.store.getState()
.session.session.user.token
);
```

Then copying the value that flashes on your screen.

Then, to log in to scratchclient, use this code:
```python
from scratchclient import ScratchSession

session = ScratchSession("username", session_id="session ID here", token="token here")
```

However, a lot of functionality still might not work. Sites like [Glitch](https://glitch.com/) could serve your purpose in that case- or you can just host it on your own computer.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ theme:

nav:
- Home: 'index.md'
- Usage on Replit: 'replit.md'
- 'Examples':
- 'Basic Usage': 'examples/basic-usage.md'
- 'Stats Viewer': 'examples/stats-viewer.md'
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
setup(
name="scratchclient",
packages=["scratchclient"],
version="0.5.2",
version="1.0.0",
license="MIT",
description="A scratch API wrapper for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
author="CubeyTheCube",
author_email="turtles142857@gmail.com",
url="https://github.com/CubeyTheCube/scratchclient",
download_url="https://github.com/CubeyTheCube/scratchclient/archive/v_05.2.tar.gz",
download_url="https://github.com/CubeyTheCube/scratchclient/archive/v_10.0.tar.gz",
keywords=["scratch", "api"],
install_requires=["requests"],
extras_require={"fast": ["numpy", "wsaccel"]},
Expand Down

0 comments on commit 0afbca2

Please sign in to comment.