Skip to content

Commit

Permalink
reformatted auth file
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Sep 29, 2023
1 parent e41c473 commit f55fff8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ably/rest/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from ably.decorator.sync import optional_sync
from ably.types.options import Options

if TYPE_CHECKING:
from ably.rest.rest import AblyRest
from ably.realtime.realtime import AblyRealtime
Expand All @@ -26,7 +27,6 @@


class Auth:

class Method:
BASIC = "BASIC"
TOKEN = "TOKEN"
Expand Down Expand Up @@ -106,7 +106,8 @@ async def __authorize_when_necessary(self, token_params=None, auth_options=None,

if self.ably._is_realtime:
realtime_loop = self.ably.connection.connection_manager.options.loop
future = asyncio.run_coroutine_threadsafe(self.ably.connection.connection_manager.on_auth_updated(token_details), realtime_loop)
future = asyncio.run_coroutine_threadsafe(
self.ably.connection.connection_manager.on_auth_updated(token_details), realtime_loop)
await asyncio.wrap_future(future)

return token_details
Expand Down Expand Up @@ -281,7 +282,7 @@ async def create_token_request(self, token_params: Optional[dict] = None, key_na
token_request['capability'] = str(Capability(capability))

token_request["client_id"] = (
token_params.get('client_id') or self.client_id)
token_params.get('client_id') or self.client_id)

# Note: There is no expectation that the client
# specifies the nonce; this is done by the library
Expand Down Expand Up @@ -430,6 +431,6 @@ async def token_request_from_auth_url(self, method: str, url: str, token_params,
token_request = response.text
else:
msg = 'auth_url responded with unacceptable content-type ' + content_type + \
', should be either text/plain, application/jwt or application/json',
', should be either text/plain, application/jwt or application/json',
raise AblyAuthException(msg, 401, 40170)
return token_request

0 comments on commit f55fff8

Please sign in to comment.