### Sign Up with Email and Password Source: https://supabase.com/docs/reference/python/vectorindex-deletevectors This example demonstrates how to sign up a new user with an email address and password. By default, the user will need to verify their email before logging in. ```APIDOC ## Sign Up with Email and Password ### Description Creates a new user with an email and password. Email verification may be required depending on project settings. ### Method `supabase.auth.sign_up() ### Parameters #### Request Body - **credentials** (object) - Required. Contains user credentials. - **email** (string) - Required. The user's email address. - **password** (string) - Required. The user's password. ### Request Example ```python response = supabase.auth.sign_up( { "email": "email@example.com", "password": "password", } ) ``` ### Response #### Success Response (200) Returns a user object. If email confirmation is enabled, the `session` will be null. ``` -------------------------------- ### Using Explain to Debug Queries Source: https://supabase.com/docs/reference/python/storagevectors-deletebucket This snippet shows how to use the `explain()` method to get the Postgres `EXPLAIN` execution plan of a query for debugging purposes. It includes an example with `analyze` and `verbose` options enabled. ```APIDOC ## Using explain For debugging slow queries, you can get the Postgres `EXPLAIN` execution plan of a query using the `explain()` method. This works on any query, even for `rpc()` or writes. ### Parameters * `wal` (boolean) - Optional - If `true`, include information on WAL record generation. * `verbose` (boolean) - Optional - If `true`, the query identifier will be returned and `data` will include the output columns of the query. * `settings` (boolean) - Optional - If `true`, include information on configuration parameters that affect query planning. * `format` (boolean) - Optional - The format of the output, can be `"text"` (default) or `"json"`. * `format` (string) - Optional - The format of the output, can be `"text"` (default) or `"json"`. * `buffers` (boolean) - Optional - If `true`, include information on buffer usage. * `analyze` (boolean) - Optional - If `true`, the query will be executed and the actual run time will be returned. ### Request Example Get the execution plan ```python response = ( supabase.table("planets") .select("*") .explain() .execute() ) ``` Get the execution plan with analyze and verbose ```python response = ( supabase.table("planets") .select("*") .explain(analyze=True, verbose=True) .execute() ) ``` ``` -------------------------------- ### Limit the query to a range Source: https://supabase.com/docs/reference/python/rangegte Limit the query result by starting at an offset (`start`) and ending at the offset (`end`). This respects the query order. The `start` and `end` values are 0-based and inclusive. ```APIDOC ## Limit the query to a range Limit the query result by starting at an offset (`start`) and ending at the offset (`end`). Only records within this range are returned. This respects the query order and if there is no order clause the range could behave unexpectedly. The `start` and `end` values are 0-based and inclusive: `range(1, 3)` will include the second, third and fourth rows of the query. ### Parameters * start Required number The starting index from which to limit the result. * end Required number The last index to which to limit the result. * foreign_table Optional string Set this to limit rows of foreign tables instead of the parent table. With `select()`On a foreign table ```python response = ( supabase.table("planets") .select("name") .range(0, 1) .execute() ) ``` ``` -------------------------------- ### Sign up with email and password Source: https://supabase.com/docs/reference/python/auth-signinwithsso This example demonstrates how to sign up a new user with an email address and password using the `supabase.auth.sign_up` method. ```APIDOC ## Sign up with email and password ### Description This method allows users to sign up for a new account using their email address and a password. Depending on your project's configuration, the user may need to verify their email before they can log in. ### Method `supabase.auth.sign_up()` ### Parameters * **credentials** (object) - Required. An object containing the user's sign-up details. * **email** (string) - Required. The user's email address. * **password** (string) - Required. The user's chosen password. ### Request Example ```python response = supabase.auth.sign_up( { "email": "email@example.com", "password": "password", } ) ``` ### Response * **user** (object) - Information about the newly created user. * **session** (object | null) - The user's session object if email confirmation is disabled, otherwise null. ``` -------------------------------- ### Initializing the Supabase Client Source: https://supabase.com/docs/reference/python/not Demonstrates how to create a new Supabase client instance using the `create_client()` method with URL and Key. ```APIDOC ## Initializing the Supabase Client You can initialize a new Supabase client using the `create_client()` method. ### Description The Supabase client is your entrypoint to the rest of the Supabase functionality and is the easiest way to interact with everything we offer within the Supabase ecosystem. ### Parameters * **supabase_url** (string) - Required - The unique Supabase URL which is supplied when you create a new project in your project dashboard. * **supabase_key** (string) - Required - The unique Supabase Key which is supplied when you create a new project in your project dashboard. * **options** (ClientOptions) - Optional - Options to change the Auth behaviors. ### Example Usage ```python import os from supabase import create_client, Client url: str = os.environ.get("SUPABASE_URL") key: str = os.environ.get("SUPABASE_KEY") supabase: Client = create_client(url, key) ``` ``` -------------------------------- ### Using explain() Source: https://supabase.com/docs/reference/python/getchannels For debugging slow queries, you can get the Postgres `EXPLAIN` execution plan of a query using the `explain()` method. This works on any query, even for `rpc()` or writes. Explain is not enabled by default as it can reveal sensitive information about your database. It's best to only enable this for testing environments but if you wish to enable it for production you can provide additional protection by using a `pre-request` function. Follow the Performance Debugging Guide to enable the functionality on your project. ```APIDOC ## Using explain ### Parameters * wal Optional boolean If `true`, include information on WAL record generation. * verbose Optional boolean If `true`, the query identifier will be returned and `data` will include the output columns of the query. * settings Optional boolean If `true`, include information on configuration parameters that affect query planning. * format Optional boolean The format of the output, can be `"text"` (default) or `"json"`. * format Optional "text" | "json" The format of the output, can be `"text"` (default) or `"json"`. * buffers Optional boolean If `true`, include information on buffer usage. * analyze Optional boolean If `true`, the query will be executed and the actual run time will be returned. Get the execution planGet the execution plan with analyze and verbose ```python response = ( supabase.table("planets") .select("*") .explain() .execute() ) ``` ``` -------------------------------- ### Sign Up with Email and Password Source: https://supabase.com/docs/reference/python/auth-exchangecodeforsession This snippet demonstrates how to sign up a new user with an email and password. Depending on your project's 'Confirm email' setting, a user object will be returned, and a session may or may not be created. ```APIDOC ## Sign Up with Email and Password ### Description Signs up a new user with an email and password. The response depends on the 'Confirm email' setting in your project. ### Method `supabase.auth.sign_up()` ### Parameters #### Request Body - **credentials** (object) - Required - Contains user credentials. - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example ```python response = supabase.auth.sign_up( { "email": "email@example.com", "password": "password", } ) ``` ### Response #### Success Response (200) - **user** (object) - The user object. - **session** (object | null) - The session object, or null if email confirmation is required. ``` -------------------------------- ### Install Supabase Python Client with Conda Source: https://supabase.com/llms/python.txt Install the supabase-py library using Conda from the conda-forge channel. ```sh conda install -c conda-forge supabase ``` -------------------------------- ### Install supabase-py Source: https://supabase.com/docs/reference/python/auth-admin-listusers Install the supabase-py library using pip. Ensure you are using Python version 3.8 or higher. ```bash pip install supabase ``` -------------------------------- ### Subscribe to a Channel and Listen for Broadcasts Source: https://supabase.com/docs/reference/python/auth-getsession This example demonstrates how to subscribe to a channel, set up a callback for broadcast messages, and send a broadcast message. ```APIDOC ## Subscribe to Channel and Listen for Broadcasts ### Description Subscribes to a channel, sets up a callback to handle broadcast messages, and sends a broadcast message. ### Method `channel.on_broadcast(event: str, callback: callable).subscribe(callback: callable)` ### Parameters #### Channel Subscription Parameters - **channel** (Channel) - The channel object to subscribe to. - **event** (str) - The name of the broadcast event to listen for. - **callback** (callable) - The function to be called when the broadcast event is received. - **on_subscribe** (callable) - Optional callback function to be executed upon subscription status change. ### Request Example ```python import asyncio import random # Assuming 'supabase' is an initialized Supabase client channel = supabase.channel("room1") def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) def handle_broadcast(payload): print("Cursor position received!", payload) await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ### Response #### Success Response (Subscription) - The `on_subscribe` callback will be invoked with the subscription status. #### Success Response (Broadcast) - The `handle_broadcast` callback will be invoked with the received payload when a broadcast message is sent to the specified event. ``` -------------------------------- ### Limit the query to a range of rows Source: https://supabase.com/docs/reference/python/auth-admin-listusers Use the `.range()` method with `start` and `end` parameters to retrieve a specific slice of data. Remember that `start` and `end` are 0-based and inclusive. ```python response = ( supabase.table("planets") .select("name") .range(0, 1) .execute() ) ``` -------------------------------- ### Subscribe to a channel and handle broadcast messages Source: https://supabase.com/docs/reference/python/storagevectors-deletebucket This example demonstrates how to create a channel, subscribe to it, and handle incoming broadcast messages. It also shows how to send a broadcast message upon successful subscription. ```APIDOC ## Subscribe to channel This example shows how to subscribe to a channel and handle broadcast messages. ### Usage 1. Create a channel instance. 2. Define callback functions for subscription status and broadcast messages. 3. Subscribe to the channel with the defined callbacks. 4. Send a broadcast message upon successful subscription. ### Code Example ```python import asyncio import random # Assuming supabase client and RealtimeSubscribeStates are available # from supabase import create_client, RealtimeSubscribeStates # Placeholder for actual Supabase client initialization # supabase = create_client(SUPABASE_URL, SUPABASE_KEY) channel = supabase.channel("room1") def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) def handle_broadcast(payload): print("Cursor position received!", payload) await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ### Notes - By default, Broadcast and Presence are enabled for all projects. - Presence is automatically enabled when you attach presence callbacks. - Listening to database changes is disabled by default for new projects and can be enabled via Realtime's replication settings. - To receive previous data for updates and deletes, set the table's `REPLICA IDENTITY` to `FULL`. ``` -------------------------------- ### Get query execution plan with explain() Source: https://supabase.com/docs/reference/python/auth-admin-oauth-deleteclient Use the `explain()` method to get the Postgres `EXPLAIN` execution plan for debugging slow queries. This can be used on any query type. ```APIDOC ## Using explain For debugging slow queries, you can get the Postgres `EXPLAIN` execution plan of a query using the `explain()` method. This works on any query, even for `rpc()` or writes. Explain is not enabled by default as it can reveal sensitive information about your database. It's best to only enable this for testing environments but if you wish to enable it for production you can provide additional protection by using a `pre-request` function. Follow the Performance Debugging Guide to enable the functionality on your project. ### Parameters * wal Optional boolean If `true`, include information on WAL record generation. * verbose Optional boolean If `true`, the query identifier will be returned and `data` will include the output columns of the query. * settings Optional boolean If `true`, include information on configuration parameters that affect query planning. * format Optional boolean The format of the output, can be `"text"` (default) or `"json"`. * format Optional "text" | "json" The format of the output, can be `"text"` (default) or `"json"`. * buffers Optional boolean If `true`, include information on buffer usage. * analyze Optional boolean If `true`, the query will be executed and the actual run time will be returned. Get the execution planGet the execution plan with analyze and verbose ```python response = ( supabase.table("planets") .select("*") .explain() .execute() ) ``` ``` -------------------------------- ### Subscribe to a channel and listen for broadcast messages Source: https://supabase.com/docs/reference/python/auth-signinanonymously This example demonstrates how to subscribe to a Realtime channel, set up a callback for broadcast messages, and send a broadcast message. It also shows how to handle the subscription status. ```APIDOC ## Subscribe to channel This operation allows you to subscribe to a Realtime channel and listen for various events, including broadcast messages, presence updates, and database changes. ### Method ```python channel = supabase.channel("room1") def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) def handle_broadcast(payload): print("Cursor position received!", payload) await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ### Description Subscribes to a channel named 'room1'. It defines an `on_subscribe` callback to send a broadcast message when the subscription is successful and a `handle_broadcast` callback to process received broadcast messages. The `on_broadcast` method is used to set up the listener for a specific event ('cursor-pos'). ``` -------------------------------- ### Initializing the Supabase Client Source: https://supabase.com/docs/reference/python/using-modifiers Demonstrates how to initialize the Supabase client with your project URL and key. ```APIDOC ## Initializing the Supabase Client You can initialize a new Supabase client using the `create_client()` method. ### Parameters * supabase_url Required string The unique Supabase URL which is supplied when you create a new project in your project dashboard. * supabase_key Required string The unique Supabase Key which is supplied when you create a new project in your project dashboard. * options Optional ClientOptions Options to change the Auth behaviors. ### Request Example ```python import os from supabase import create_client, Client url: str = os.environ.get("SUPABASE_URL") key: str = os.environ.get("SUPABASE_KEY") supabase: Client = create_client(url, key) ``` ``` -------------------------------- ### Using explain() to get query execution plan Source: https://supabase.com/docs/reference/python/storage-from-createsignedurl Get the Postgres `EXPLAIN` execution plan of a query for debugging slow queries. This works on any query, including `rpc()` and writes. ```APIDOC ## Using explain For debugging slow queries, you can get the Postgres `EXPLAIN` execution plan of a query using the `explain()` method. This works on any query, even for `rpc()` or writes. ### Parameters #### Query Parameters * **wal** (boolean) - Optional - If `true`, include information on WAL record generation. * **verbose** (boolean) - Optional - If `true`, the query identifier will be returned and `data` will include the output columns of the query. * **settings** (boolean) - Optional - If `true`, include information on configuration parameters that affect query planning. * **buffers** (boolean) - Optional - If `true`, include information on buffer usage. * **analyze** (boolean) - Optional - If `true`, the query will be executed and the actual run time will be returned. * **format** (string) - Optional - The format of the output, can be `"text"` (default) or `"json"`. ### Request Example Get the execution plan: ```python response = ( supabase.table("planets") .select("*") .explain() .execute() ) ``` Get the execution plan with analyze and verbose: ```python response = ( supabase.table("planets") .select("*") .explain(analyze=True, verbose=True) .execute() ) ``` ### Response #### Success Response Returns the query execution plan in the specified format (default is text). ``` -------------------------------- ### Subscribe to a channel and listen for broadcast messages Source: https://supabase.com/docs/reference/python/auth-signinwithidtoken This example demonstrates how to create a channel, subscribe to it, and then listen for broadcast messages. It also shows how to send a broadcast message after subscribing. ```APIDOC ## Subscribe to channel and listen for broadcast messages ### Description This example demonstrates how to create a channel, subscribe to it, and then listen for broadcast messages. It also shows how to send a broadcast message after subscribing. ### Method ```python channel = supabase.channel("room1") def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) def handle_broadcast(payload): print("Cursor position received!", payload) await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get Query Execution Plan with Analyze and Verbose Source: https://supabase.com/llms/python.txt For more detailed debugging, use .explain() with analyze=True and verbose=True to get an analyzed and verbose execution plan. This provides more insights into query performance. ```python response = ( supabase.table("planets") .select("*") .explain(analyze=True, verbose=True) .execute() ) ``` -------------------------------- ### Limit the query to a range Source: https://supabase.com/docs/reference/python/storageanalytics-listbuckets Limits the query result by starting at an offset (`start`) and ending at the offset (`end`). Only records within this range are returned. This respects the query order and if there is no order clause the range could behave unexpectedly. The `start` and `end` values are 0-based and inclusive: `range(1, 3)` will include the second, third and fourth rows of the query. This can also be applied to foreign tables. ```APIDOC ## Limit the query to a range ### Description Limits the query result by starting at an offset (`start`) and ending at the offset (`end`). Only records within this range are returned. This respects the query order and if there is no order clause the range could behave unexpectedly. The `start` and `end` values are 0-based and inclusive: `range(1, 3)` will include the second, third and fourth rows of the query. This can also be applied to foreign tables. ### Parameters #### Query Parameters - **start** (number) - Required - The starting index from which to limit the result. - **end** (number) - Required - The last index to which to limit the result. - **foreign_table** (string) - Optional - Set this to limit rows of foreign tables instead of the parent table. ### Request Example ```python response = ( supabase.table("planets") .select("name") .range(0, 1) .execute() ) ``` ``` -------------------------------- ### Subscribe to a channel and listen for broadcast messages Source: https://supabase.com/docs/reference/python/auth-admin-oauth-getclient This example demonstrates how to subscribe to a channel, set up a callback for when the subscription is successful, and then send and receive broadcast messages. ```APIDOC ## Subscribe to channel and listen for broadcast messages ### Description Subscribes to a channel and sets up a listener for broadcast messages. It also includes a callback for subscription status and sends a broadcast message upon successful subscription. ### Usage ```python channel = supabase.channel("room1") def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) def handle_broadcast(payload): print("Cursor position received!", payload) await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ### Parameters - `channel`: The Realtime channel object. - `on_subscribe`: A callback function that is executed when the subscription status changes. It receives `status` and `err` as arguments. - `handle_broadcast`: A callback function that processes incoming broadcast messages. It receives the `payload` of the message. - `event`: The name of the broadcast event to listen for. - `callback`: The function to call when the broadcast event is received. - `send_broadcast`: A method to send a broadcast message to the channel. It takes an event name and a payload. ### Notes - Presence and Broadcast are enabled by default. - Database change listening is disabled by default and requires configuration. - Row level security is not applied to delete statements. ``` -------------------------------- ### Sign up with Email and Password Source: https://supabase.com/docs/reference/python/auth-admin-oauth-createclient Use this method to create a new user with an email and password. The user will need to verify their email unless 'Confirm email' is disabled in your project settings. ```python response = supabase.auth.sign_up( { "email": "email@example.com", "password": "password", } ) ``` -------------------------------- ### Limit the query to a range Source: https://supabase.com/docs/reference/python/auth-getclaims Limits the query result by starting at an offset (`start`) and ending at the offset (`end`). Only records within this range are returned. This respects the query order and if there is no order clause the range could behave unexpectedly. The `start` and `end` values are 0-based and inclusive: `range(1, 3)` will include the second, third and fourth rows of the query. You can optionally specify a foreign table. ```APIDOC ## Limit the query to a range ### Description Limits the query result by starting at an offset (`start`) and ending at the offset (`end`). Only records within this range are returned. This respects the query order and if there is no order clause the range could behave unexpectedly. The `start` and `end` values are 0-based and inclusive: `range(1, 3)` will include the second, third and fourth rows of the query. You can optionally specify a foreign table. ### Parameters #### Query Parameters - **start** (number) - Required - The starting index from which to limit the result. - **end** (number) - Required - The last index to which to limit the result. - **foreign_table** (string) - Optional - Set this to limit rows of foreign tables instead of the parent table. ### Request Example ```python response = ( supabase.table("planets") .select("name") .range(0, 1) .execute() ) ``` ``` -------------------------------- ### Create a new user with email and password Source: https://supabase.com/docs/reference/python/auth-admin-oauth-createclient This method allows you to sign up a new user with their email and password. By default, the user will need to verify their email address. If email confirmation is disabled in your project settings, a session will be returned immediately. ```APIDOC ## Create a new user ### Description Creates a new user with the provided email and password. Email verification is required by default unless disabled in project settings. ### Method `supabase.auth.sign_up(credentials)` ### Parameters #### credentials (object) - Required An object containing user credentials. - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example ```python response = supabase.auth.sign_up({ "email": "email@example.com", "password": "password" }) ``` ### Response #### Success Response (200) Returns a user object and potentially a session object depending on email confirmation settings. - **user** (object) - The newly created user object. - **session** (object | null) - The user's session object if email confirmation is disabled, otherwise null. ``` -------------------------------- ### Get Query Execution Plan Source: https://supabase.com/docs/reference/python/auth-admin-listusers Use the .explain() method to get the Postgres EXPLAIN execution plan for a query. This is helpful for debugging slow queries. Ensure explain functionality is enabled in your Supabase project settings. ```python response = ( supabase.table("planets") .select("*") .explain() .execute() ) ``` -------------------------------- ### Subscribe to a channel and listen for broadcast messages Source: https://supabase.com/docs/reference/python/auth-exchangecodeforsession This example demonstrates how to subscribe to a channel named 'room1', set up a callback for broadcast messages, and send a broadcast message. The `on_subscribe` callback handles the subscription status, and `handle_broadcast` processes incoming messages. ```APIDOC ## Subscribe to channel ### Description Subscribes to a channel and sets up listeners for broadcast messages. It also includes an example of sending a broadcast message. ### Method `channel.on_broadcast(event: str, callback: callable).subscribe(callback: callable)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python channel = supabase.channel("room1") def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) def handle_broadcast(payload): print("Cursor position received!", payload) await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ### Response #### Success Response (200) None (The `subscribe` method does not return a value, but it establishes a connection and sets up listeners). #### Response Example None ``` -------------------------------- ### Retrieve all channels Source: https://supabase.com/docs/reference/python/lte Gets a list of all currently subscribed channels. ```APIDOC ## Retrieve all channels ### Description Retrieves a list of all currently subscribed channels. ### Method `get_channels` ### Parameters None ``` -------------------------------- ### sign_up() Source: https://supabase.com/llms/python.txt Creates a new user account. The behavior regarding email confirmation and returned data depends on your project's authentication settings. ```APIDOC ## sign_up() ### Description Creates a new user account. The behavior regarding email confirmation and returned data depends on your project's authentication settings. - If 'Confirm email' is enabled, a `user` is returned but `session` is null. - If 'Confirm email' is disabled, both a `user` and a `session` are returned. ### Method `supabase.auth.sign_up(attributes, options=None)` ### Parameters #### Attributes - **email** (string) - Optional - The user's email address. - **password** (string) - Optional - The user's password. - **phone** (string) - Optional - The user's phone number. #### Options - **data** (object) - Optional - Additional user metadata to be stored. - **email_redirect_to** (string) - Optional - A URL to redirect the user to after email confirmation. - **channel** (string) - Optional - The channel to use for phone verification (e.g., 'whatsapp'). ### Examples #### Sign up with an email and password ```python response = supabase.auth.sign_up({ "email": "email@example.com", "password": "password", }) ``` #### Sign up with a phone number and password (SMS) ```python response = supabase.auth.sign_up({ "phone": "123456789", "password": "password", }) ``` #### Sign up with a phone number and password (whatsapp) ```python response = supabase.auth.sign_up({ "phone": "123456789", "password": "password", "options": {"channel": "whatsapp"}, }) ``` #### Sign up with additional user metadata ```python response = supabase.auth.sign_up({ "email": "email@example.com", "password": "password", "options": {"data": {"first_name": "John", "age": 27}}, }) ``` #### Sign up with a redirect URL ```python response = supabase.auth.sign_up({ "email": "hello1@example.com", "password": "password", "options": { "email_redirect_to": "https://example.com/welcome", }, }) ``` ``` -------------------------------- ### Get bucket Source: https://supabase.com/docs/reference/python/db-csv Retrieves the details of an existing Storage bucket. ```APIDOC ## Get bucket ### Description Retrieves the details of an existing Storage bucket. ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the bucket you would like to retrieve. ### Request Example ```python response = supabase.storage.get_bucket("avatars") ``` ``` -------------------------------- ### Get OAuth client Source: https://supabase.com/docs/reference/python/auth-admin-inviteuserbyemail Retrieves details of an OAuth client by its ID. ```APIDOC ## Get OAuth client Retrieves details of an OAuth client by ID. ### Parameters * client_id Required string The ID of the OAuth client to retrieve. ### Request Example ```python response = supabase.auth.admin.oauth.get_client("client-id") ``` ``` -------------------------------- ### Subscribe to a Channel with Broadcast and Presence Source: https://supabase.com/docs/reference/python/storageanalytics-deletebucket This example demonstrates how to subscribe to a Realtime channel, set up a callback for broadcast messages, and send a broadcast message. It also touches upon the default enabling of Broadcast and Presence. ```APIDOC ## Subscribe to channel * By default, Broadcast and Presence are enabled for all projects. * Presence is automatically enabled when you attach presence callbacks (`on_presence_sync()`, `on_presence_join()`, or `on_presence_leave()`). If you add presence callbacks to an already joined channel, the channel will automatically resubscribe with presence enabled. * By default, listening to database changes is disabled for new projects due to database performance and security concerns. You can turn it on by managing Realtime's replication. * You can receive the "previous" data for updates and deletes by setting the table's `REPLICA IDENTITY` to `FULL` (e.g., `ALTER TABLE your_table REPLICA IDENTITY FULL;`). * Row level security is not applied to delete statements. When RLS is enabled and replica identity is set to full, only the primary key is sent to clients. Listen to broadcast messages Listen to presence sync Listen to presence join Listen to presence leave Listen to all database changes Listen to a specific table Listen to inserts Listen to updates Listen to deletes Listen to multiple events Listen to row level changes ```python 1 channel = supabase.channel("room1") 2 3 def on_subscribe(status, err): if status == RealtimeSubscribeStates.SUBSCRIBED: asyncio.create_task(channel.send_broadcast( "cursor-pos", {"x": random.random(), "y": random.random()} )) 9 10 def handle_broadcast(payload): print("Cursor position received!", payload) 12 13 await channel.on_broadcast(event="cursor-pos", callback=handle_broadcast).subscribe(on_subscribe) ``` ```