Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
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
12 changes: 5 additions & 7 deletions gotrue/_async/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
self.url = url
self.headers = headers
self.cookie_options = cookie_options
self.http_client = http_client if http_client else AsyncClient()
self.http_client = http_client or AsyncClient()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AsyncGoTrueAPI.__init__ refactored with the following changes:


async def __aenter__(self) -> AsyncGoTrueAPI:
return self
Expand Down Expand Up @@ -238,10 +238,9 @@ async def sign_in_with_phone(
error : APIError
If an error occurs
"""
headers = self.headers
query_string = "?grant_type=password"
data = {"phone": phone, "password": password}
url = f"{self.url}/token{query_string}"
Comment on lines 241 to -244
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AsyncGoTrueAPI.sign_in_with_phone refactored with the following changes:

url = f'{self.url}/token?grant_type=password'
headers = self.headers
response = await self.http_client.post(url, json=data, headers=headers)
return Session.parse_response(response)

Expand Down Expand Up @@ -575,10 +574,9 @@ async def refresh_access_token(self, *, refresh_token: str) -> Session:
error : APIError
If an error occurs
"""
headers = self.headers
query_string = "?grant_type=refresh_token"
data = {"refresh_token": refresh_token}
url = f"{self.url}/token{query_string}"
Comment on lines 577 to -581
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AsyncGoTrueAPI.refresh_access_token refactored with the following changes:

url = f'{self.url}/token?grant_type=refresh_token'
headers = self.headers
response = await self.http_client.post(url, json=data, headers=headers)
return Session.parse_response(response)

Expand Down
12 changes: 5 additions & 7 deletions gotrue/_sync/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
self.url = url
self.headers = headers
self.cookie_options = cookie_options
self.http_client = http_client if http_client else SyncClient()
self.http_client = http_client or SyncClient()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SyncGoTrueAPI.__init__ refactored with the following changes:


def __enter__(self) -> SyncGoTrueAPI:
return self
Expand Down Expand Up @@ -238,10 +238,9 @@ def sign_in_with_phone(
error : APIError
If an error occurs
"""
headers = self.headers
query_string = "?grant_type=password"
data = {"phone": phone, "password": password}
url = f"{self.url}/token{query_string}"
Comment on lines 241 to -244
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SyncGoTrueAPI.sign_in_with_phone refactored with the following changes:

url = f'{self.url}/token?grant_type=password'
headers = self.headers
response = self.http_client.post(url, json=data, headers=headers)
return Session.parse_response(response)

Expand Down Expand Up @@ -575,10 +574,9 @@ def refresh_access_token(self, *, refresh_token: str) -> Session:
error : APIError
If an error occurs
"""
headers = self.headers
query_string = "?grant_type=refresh_token"
data = {"refresh_token": refresh_token}
url = f"{self.url}/token{query_string}"
Comment on lines 577 to -581
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SyncGoTrueAPI.refresh_access_token refactored with the following changes:

url = f'{self.url}/token?grant_type=refresh_token'
headers = self.headers
response = self.http_client.post(url, json=data, headers=headers)
return Session.parse_response(response)

Expand Down