Verify the ownership of a Scratch account.
pip install scratch-verify
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)
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"
Verify whether the user is authenticated.
Type: string
The username to authenticate.
Type: string
The code to check for.
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
- scratch-verify - JavaScript version.