https://github.com/richienb/scratch-verify-python
Verify the ownership of a Scratch account.
https://github.com/richienb/scratch-verify-python
Last synced: 9 months ago
JSON representation
Verify the ownership of a Scratch account.
- Host: GitHub
- URL: https://github.com/richienb/scratch-verify-python
- Owner: Richienb
- License: mit
- Created: 2021-01-08T01:05:34.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T21:07:52.000Z (almost 4 years ago)
- Last Synced: 2025-04-16T09:14:33.964Z (9 months ago)
- Language: Python
- Size: 20.5 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Code of conduct: .github/code_of_conduct.md
Awesome Lists containing this project
README
# scratch-verify
Verify the ownership of a Scratch account.
[](https://pypi.org/project/scratch-verify)
## Install
```sh
pip install scratch-verify
```
## Usage
```py
from scratch_verify import create_code, verify_code
# The user should go to https://scratch.mit.edu/projects/440710593 and provide `code`
code = create_code()
# Verify if the user provided it
is_verified = verify_code(username, code)
```
## API
### scratch_verify.create_code()
Generate a verification code for the user to provide at https://scratch.mit.edu/projects/440710593. This is just a convenience method - you can use any numerical code. Returns a 6-digit number.
```py
from scratch_verify import create_code
print(create_code())
#=> "435543"
```
### scratch_verify.verify_code(username, code, completion_timeout?)
Verify whether the user is authenticated.
#### username
Type: `string`
The username to authenticate.
#### code
Type: `string`
The code to check for.
#### completion_timeout
Type: `number`\
Default: `Infinity`
The maximum amount of seconds that can pass since the user provided the code before it is no longer accepted.
```py
from scratch_verify import verify_code
# If the user has authenticated
print(verify_code("RichieNB", "435543"))
#=> True
```
## Related
- [scratch-verify](https://github.com/Richienb/scratch-verify) - JavaScript version.