Python API Implementation
This guide covers the installation and usage of package in Python.
Python API
1
Install How2Validate dependency
Get the latest version from How2Validate Python Package Registry
pip install how2validate
2
Create Function
Create a function to validate secrets using below Syntax
validate(provider, service, secret, response, report)
Validates a secret against the specified provider and service.
Parameters:
provider (string): The name of the provider (e.g., "NPM", "GitHub").service (string): The specific service or token type.secret (string): The secret to validate.response (boolean): Iftrue, returns the full response.report (string): Email Id to send a detailed report (Alpha Feature).
Returns:
validation_result (object): An object containing the validation status and details.
3
Sample Function
Function implementation of validation:
from how2validate import validate
result = validate(
provider="NPM",
service="NPM Access Token",
secret="<<SECRET>>",
response=True/False,
report="useremail@domain.com"
)
print(result)