
    'Xh                     V    d dl Z d dlmZmZmZmZ d dlZ G d dej                        Zy)    N)	AwaitableCallableOptionalUnionc                       e Zd Zdeeg ef   eg ee   f   f   fdZdefdZde	j                  de	j                  fdZdefdZde	j                  de	j                  fdZy	)

BearerAuthauth_token_providerc                     d | _         d | _        t        j                  |      r|| _         y t	        |      r|| _        y t        d      )Nz3auth_token_provider must be a callable or awaitable)async_token
sync_tokenasyncioiscoroutinefunctioncallable
ValueError)selfr	   s     H/RAG/venv/lib/python3.12/site-packages/qdrant_client/auth/bearer_auth.py__init__zBearerAuth.__init__   sH     DH7;&&':;2D+,"5 !VWW    returnc                 P    | j                   t        d      | j                         S )Nz&Synchronous token provider is not set.)r   r   r   s    r   _sync_get_tokenzBearerAuth._sync_get_token   s%    ??"EFF  r   requestc              #   X   K   | j                         }d| |j                  d<   | y wNzBearer Authorization)r   headersr   r   tokens      r   sync_auth_flowzBearerAuth.sync_auth_flow   s.     $$&-4UG+<(s   (*c                 v   K   | j                   | j                          d {   S | j                         S 7 w)N)r   r   r   s    r   _async_get_tokenzBearerAuth._async_get_token!   s8     '))+++##%% ,s    979c                n   K   | j                          d {   }d| |j                  d<   | y 7 wr   )r"   r   r   s      r   async_auth_flowzBearerAuth.async_auth_flow'   s6     ++---4UG+<( .s   535N)__name__
__module____qualname__r   r   strr   r   r   httpxRequestr    r"   r$    r   r   r   r      s    X"8BG#4hr9S>?Q6R#RSX! !
emm  
& &U]] u}} r   r   )	r   typingr   r   r   r   r)   Authr   r+   r   r   <module>r.      s!     7 7 # #r   