SDKs

Choose an SDK

Python SDK Usage

Install the BrownieGate Python SDK with pip:

pip install -U git+https://github.com/Bwownie/BrownieGate-package

Initialize the client:


from browniegate import BrownieClient

client = BrownieClient(
    api_key="API_KEY",
    project_uuid="PROJECT_ID",
    encryption_key="ENCRYPTION_KEY"
)
            

Ping the API to verify connectivity and credentials:


if client.ping():
    print("Ping successful")
else:
    print("Ping unsuccessful")
            

Verify and decode a callback payload:


payload = "PAYLOAD"

decrypted_payload = client.decrypt_payload(payload)
success, user_id = client.verify_payload(decrypted_payload)

if success:
    print(f"Success! user_id: {user_id}")
else:
    print("Payload verification failed")
            

Decrypt and validate an authentication cookie:


cookie = "COOKIE"

user_id, cookie_hash = client.decrypt_cookie(cookie)
is_valid = client.validate_cookie(user_id, cookie_hash)

if is_valid:
    print("Cookie validated")
else:
    print("Invalid cookie")
            

Retrieve user data:


user_id = "USER_ID"

success, data = client.get_user_data(user_id)

if success:
    print(f"User data: {data}")
else:
    print("Error getting user data")
            

Retrieve a user's profile picture:


user_id = "USER_ID"

pfp = client.get_pfp(user_id)