Garberchov
Garberchov

Reputation: 67

Supabase-Py: TypeError: __init__() got an unexpected keyword argument 'headers' when making client

I have been using supabase in python without problem but today I got an error when I went to create my client. Code is below, all help would be great. Code

from supabase import create_client, Client
supabaseUrl = 'REDACTED'
supabaseKey = 'REDACTED'
supabase = create_client(supabaseUrl, supabaseKey)
path_data = supabase.table('otto').select('*').execute()
print(path_data)

My Error:

Traceback (most recent call last):
  File "andrew_main.py", line 7, in <module>
    supabase: Client = create_client(supabase_url=supabaseUrl, supabase_key=supabaseKey)
  File "/home/garb/.local/lib/python3.8/site-packages/supabase/client.py", line 226, in create_client
    return Client(supabase_url=supabase_url, supabase_key=supabase_key, **options)
  File "/home/garb/.local/lib/python3.8/site-packages/supabase/client.py", line 70, in __init__
    self.postgrest: PostgrestClient = self._init_postgrest_client(
  File "/home/garb/.local/lib/python3.8/site-packages/supabase/client.py", line 185, in _init_postgrest_client
    client = PostgrestClient(rest_url, headers=headers)
TypeError: __init__() got an unexpected keyword argument 'headers'

Upvotes: 0

Views: 3053

Answers (1)

aaron
aaron

Reputation: 43083

You are using outdated versions of postgrest-py (< 0.5.0) and supabase (< 0.1.1).

The error is likely caused by accidentally downgrading postgrest-py.

You should be able to fix this by running pip install -U supabase, which upgrades supabase (currently 0.5.3) and installs the compatible version of postgrest-py (currently 0.9.2).
Omit the -U flag if you only want to install the compatible version of postgrest-py without upgrading supabase.

References

Upvotes: 1

Related Questions