Error : Supabase url is required , Python

464 Views Asked by At

I've been faced SupabaseException: supabase_url is required. Here are codes

import os
from supabase import create_client, Client

url: str = os.environ.get('https://mine.supabase.co')
key: str = os.environ.get("xxxxminexxx")
supabase: Client = create_client(url, key)

SupabaseException: supabase_url is required.

supabase version : 1.0.4 python : 3.10.9

i don't know how to deal with this problem. Plz help.

  1. make account supabase https://supabase.com/
  2. pip install supabase
  3. Run code
  4. Error
1

There are 1 best solutions below

0
Andrew Smith On

If you are getting the environment variables from the operating system you should be checking for the variable name which you can setup with dotenv python package or a normal export SUPABASE_URL="my-url-to-my-awesome-supabase-instance" and not a url or anon_key as you have in your example. Take a look at the example below which is also outlined in the Supabase Python docs

import os
from supabase import create_client

url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_KEY")
supabase = create_client(url, key)