Verify the ownership of a Scratch account.
Project description
scratch-verify
Verify the ownership of a Scratch account.
Install
pip install scratch-verify
Usage
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.
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.
from scratch_verify import verify_code
# If the user has authenticated
print(verify_code("RichieNB", "435543"))
#=> True
Related
- scratch-verify - JavaScript version.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scratch-verify-1.0.1.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for scratch_verify-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e27f1a5513ed62586e031053df806ce449be73cb05dc5e5f65911f6b75fba7e2 |
|
MD5 | 45766bd616ba8d0d2b5d9cb8fda6350e |
|
BLAKE2b-256 | 42e7d8e340ba34c7050ea67af826ea2a3e5c3549cb50f53a6893dc4f875bb2b6 |