
    Ng                     T    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dS )    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d	S )

BearerAuthauth_token_providerc                     d | _         d | _        t          j        |          r	|| _         d S t	          |          r	|| _        d S t          d          )Nz3auth_token_provider must be a callable or awaitable)async_token
sync_tokenasyncioiscoroutinefunctioncallable
ValueError)selfr	   s     Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/qdrant_client/auth/bearer_auth.py__init__zBearerAuth.__init__   sd     DH7;&':;; 	X2D+,, X"5 !VWWW    returnc                 V    | j         t          d          |                                  S )Nz&Synchronous token provider is not set.)r   r   r   s    r   _sync_get_tokenzBearerAuth._sync_get_token   s)    ?"EFFF   r   requestc              #   T   K   |                                  }d| |j        d<   |V  d S NzBearer Authorization)r   headersr   r   tokens      r   sync_auth_flowzBearerAuth.sync_auth_flow   s8      $$&&+<U+<+<(r   c                 p   K   | j         |                                   d {V S |                                 S )N)r   r   r   s    r   _async_get_tokenzBearerAuth._async_get_token!   sE      '))+++++++++##%%%r   c                b   K   |                                   d {V }d| |j        d<   |W V  d S r   )r"   r   r   s      r   async_auth_flowzBearerAuth.async_auth_flow'   sL      ++--------+<U+<+<(r   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 X X X! ! ! ! !
em     
& & & & &U] u}      r   r   )	r   typingr   r   r   r   r)   Authr   r+   r   r   <module>r.      sq     7 7 7 7 7 7 7 7 7 7 7 7 # # # # # # # # # #r   