diff --git a/docs/assets/session-id.png b/docs/assets/session-id.png new file mode 100644 index 0000000..669ec20 Binary files /dev/null and b/docs/assets/session-id.png differ diff --git a/docs/index.md b/docs/index.md index a5c0dc9..0cc2886 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 diff --git a/docs/replit.md b/docs/replit.md new file mode 100644 index 0000000..c387534 --- /dev/null +++ b/docs/replit.md @@ -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. diff --git a/mkdocs.yml b/mkdocs.yml index 5d22324..26098ad 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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' diff --git a/setup.py b/setup.py index 7ceaa6b..77c5d51 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ 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, @@ -15,7 +15,7 @@ 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"]},