Skip to content

Commit 0afbca2

Browse files
committed
Some stuff I forgot
1 parent aa6a3a7 commit 0afbca2

5 files changed

Lines changed: 44 additions & 2 deletions

File tree

docs/assets/session-id.png

81.3 KB
Loading

docs/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
This is the documentation for scratchclient.
44

5+
## Installation
6+
7+
Go to your terminal (not your python shell) and execute this command:
8+
```bash
9+
pip install scratchclient
10+
```
11+
12+
If this didn't work for whatever reason, open your python shell and run the following:
13+
```python
14+
import os; os.system("pip install scratchclient")
15+
```
16+
17+
scratchclient requires Python 3.7; however, it will work for almost all use cases on Python 3.6.
18+
519
## Get Started
620
```python
721
from scratchclient import ScratchSession

docs/replit.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Usage on Replit
2+
3+
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.
4+
5+
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.
6+
7+
![Getting the session ID from browser devtools](../assets/session-id.png)
8+
9+
You can obtain your token by running this in your browser console:
10+
```js
11+
alert(
12+
document.getElementById('app')._reactRootContainer._internalRoot
13+
.current.child.pendingProps.store.getState()
14+
.session.session.user.token
15+
);
16+
```
17+
18+
Then copying the value that flashes on your screen.
19+
20+
Then, to log in to scratchclient, use this code:
21+
```python
22+
from scratchclient import ScratchSession
23+
24+
session = ScratchSession("username", session_id="session ID here", token="token here")
25+
```
26+
27+
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.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ theme:
1414

1515
nav:
1616
- Home: 'index.md'
17+
- Usage on Replit: 'replit.md'
1718
- 'Examples':
1819
- 'Basic Usage': 'examples/basic-usage.md'
1920
- 'Stats Viewer': 'examples/stats-viewer.md'

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
setup(
88
name="scratchclient",
99
packages=["scratchclient"],
10-
version="0.5.2",
10+
version="1.0.0",
1111
license="MIT",
1212
description="A scratch API wrapper for Python.",
1313
long_description=long_description,
1414
long_description_content_type="text/markdown",
1515
author="CubeyTheCube",
1616
author_email="turtles142857@gmail.com",
1717
url="https://github.com/CubeyTheCube/scratchclient",
18-
download_url="https://github.com/CubeyTheCube/scratchclient/archive/v_05.2.tar.gz",
18+
download_url="https://github.com/CubeyTheCube/scratchclient/archive/v_10.0.tar.gz",
1919
keywords=["scratch", "api"],
2020
install_requires=["requests"],
2121
extras_require={"fast": ["numpy", "wsaccel"]},

0 commit comments

Comments
 (0)