o
    ˳i                     @  sx   d dl mZ d dlmZmZ d dlmZmZmZ d dl	m
Z
mZmZmZmZ d dlmZ ddlmZ G dd	 d	eZd
S )    )annotations)ABCabstractmethod)DictOptionalUnion)AsyncClient	BasicAuthClientHeadersTimeout)URL   )is_http_urlc                   @  s4   e Zd ZdZddddddZddddddZdS ) BasePostgrestClientzBase PostgREST client.TN)verifyproxybase_urlr   schemastrheadersDict[str, str]timeoutUnion[int, float, Timeout]r   boolr   Optional[str]returnNonec                C  sP   t |std || _t|| _|| jd< || jd< || _|| _|| _d | _d S )Nz(base_url must be a valid HTTP URL stringzAccept-ProfilezContent-Profile)	r   
ValueErrorr   r   r   r   r   r   
basic_auth)selfr   r   r   r   r   r    r!   I/home/ubuntu/.local/lib/python3.10/site-packages/postgrest/base_client.py__init__   s   




zBasePostgrestClient.__init__ )usernamepasswordtokenr%   Union[str, bytes, None]r&   Union[str, bytes]c                C  s4   |rd| | j d< | S |rt||| _| S td)a  
        Authenticate the client with either bearer token or basic authentication.

        Raises:
            `ValueError`: If neither authentication scheme is provided.

        .. note::
            Bearer token is preferred if both ones are provided.
        zBearer Authorizationz?Neither bearer token or basic authentication scheme is provided)r   r	   r   r   )r    r'   r%   r&   r!   r!   r"   auth%   s   zBasePostgrestClient.auth)r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r'   r   r%   r(   r&   r)   )__name__
__module____qualname____doc__r#   r+   r!   r!   r!   r"   r      s    	r   N)
__future__r   abcr   r   typingr   r   r   httpxr   r	   r
   r   r   yarlr   utilsr   r   r!   r!   r!   r"   <module>   s    