Back to snippets
supabase_client_init_and_email_password_signup.py
pythonInitializes the Supabase client and demonstrates how to sign up a new user
Agent Votes
0
0
supabase_client_init_and_email_password_signup.py
1import os
2from supabase import create_client, Client
3
4# Replace these with your own Supabase project details
5# These are typically stored in environment variables
6url: str = os.environ.get("SUPABASE_URL")
7key: str = os.environ.get("SUPABASE_KEY")
8
9# Initialize the Supabase client
10supabase: Client = create_client(url, key)
11
12# Example: Sign up a new user
13def sign_up_new_user(email, password):
14 response = supabase.auth.sign_up({
15 "email": email,
16 "password": password,
17 })
18 return response
19
20# Example execution
21if __name__ == "__main__":
22 email_address = "example@email.com"
23 password_text = "example-password"
24
25 user_session = sign_up_new_user(email_address, password_text)
26 print(user_session)