Skip to content

fix: update SupabaseAuthClient to use super instead of calling base class #1045

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ tests_only:
build_sync:
poetry run unasync supabase tests
sed -i 's/asyncio.create_task(self.realtime.set_auth(access_token))//g' supabase/_sync/client.py
sed -i 's/asynch/synch/g' supabase/_sync/auth_client.py
sed -i 's/Async/Sync/g' supabase/_sync/auth_client.py
21 changes: 17 additions & 4 deletions supabase/_async/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class AsyncSupabaseAuthClient(AsyncGoTrueClient):
"""SupabaseAuthClient"""
"""Supabase Auth Client for asynchronous operations."""

def __init__(
self,
Expand All @@ -26,12 +26,25 @@ def __init__(
verify: bool = True,
proxy: Optional[str] = None,
):
"""Instantiate SupabaseAuthClient instance."""
"""
Instantiate a SupabaseAuthClient instance.

Args:
url (str): The URL of the Supabase instance.
headers (Optional[Dict[str, str]]): Optional headers to include in requests.
storage_key (Optional[str]): Key to store session information.
auto_refresh_token (bool): Whether to automatically refresh the token. Defaults to True.
persist_session (bool): Whether to persist the session. Defaults to True.
storage (AsyncSupportedStorage): Storage mechanism. Defaults to AsyncMemoryStorage().
http_client (Optional[AsyncClient]): HTTP client for making requests. Defaults to None.
flow_type (AuthFlowType): Type of authentication flow. Defaults to "implicit".
verify (bool): Whether to verify SSL certificates. Defaults to True.
proxy (Optional[str]): Proxy URL. Defaults to None.
"""
if headers is None:
headers = {}

AsyncGoTrueClient.__init__(
self,
super().__init__(
url=url,
headers=headers,
storage_key=storage_key,
Expand Down
21 changes: 17 additions & 4 deletions supabase/_sync/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class SyncSupabaseAuthClient(SyncGoTrueClient):
"""SupabaseAuthClient"""
"""Supabase Auth Client for synchronous operations."""

def __init__(
self,
Expand All @@ -26,12 +26,25 @@ def __init__(
verify: bool = True,
proxy: Optional[str] = None,
):
"""Instantiate SupabaseAuthClient instance."""
"""
Instantiate a SupabaseAuthClient instance.

Args:
url (str): The URL of the Supabase instance.
headers (Optional[Dict[str, str]]): Optional headers to include in requests.
storage_key (Optional[str]): Key to store session information.
auto_refresh_token (bool): Whether to automatically refresh the token. Defaults to True.
persist_session (bool): Whether to persist the session. Defaults to True.
storage (SyncSupportedStorage): Storage mechanism. Defaults to SyncMemoryStorage().
http_client (Optional[SyncClient]): HTTP client for making requests. Defaults to None.
flow_type (AuthFlowType): Type of authentication flow. Defaults to "implicit".
verify (bool): Whether to verify SSL certificates. Defaults to True.
proxy (Optional[str]): Proxy URL. Defaults to None.
"""
if headers is None:
headers = {}

SyncGoTrueClient.__init__(
self,
super().__init__(
url=url,
headers=headers,
storage_key=storage_key,
Expand Down