Ë
    8ø»j!  ã                  óè   — d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	 d dl
mZmZ d dlmZ d dlmZ erd dlmZmZ d d	lmZ d d
lmZ  e	d«       G d„ de«      «       Z e	d«       G d„ de«      «       Zy)é    )Úannotations)ÚasynccontextmanagerÚcontextmanager)ÚTYPE_CHECKINGÚAny)Ú
docs_group)ÚResourceClientÚResourceClientAsync)Ú%catch_not_found_for_resource_or_throw)ÚApifyApiError)ÚAsyncIteratorÚIterator)ÚHttpResponse)ÚTimeoutzResource clientsc                  ón   ‡ — e Zd ZdZddœ	 	 	 	 	 dˆ fd„Zdddœdd„Zdddœdd	„Zedddœdd
„«       Zˆ xZ	S )Ú	LogClientz¸Sub-client for managing a specific log.

    Provides methods to manage logs, e.g. get or stream them. Obtain an instance via an appropriate method on the
    `ApifyClient` class.
    Úlogs©Úresource_pathc               ó(   •— t        ‰| �  dd|i|¤Ž y ©Nr   © ©ÚsuperÚ__init__©Úselfr   ÚkwargsÚ	__class__s      €úY/var/www/html/GAP/venv/lib/python3.12/site-packages/apify_client/_resource_clients/log.pyr   zLogClient.__init__   ó"   ø€ ô 	‰Ññ 	
Ø'ð	
àó	
ó    FÚlong©ÚrawÚtimeoutc               óî   — 	 | j                   j                  | j                  «       d| j                  |¬«      |¬«      }|j                  S # t
        $ r }t        || j                  «       Y d}~yd}~ww xY w©aI  Retrieve the log as text.

        https://docs.apify.com/api/v2#/reference/logs/log/get-log

        404s collapse to `None` only when this client targets a specific log by ID (e.g. `client.log(run_id).get()`).
        For chained clients without a `resource_id` (e.g. `run.log().get()`), a 404 is ambiguous and propagates.

        Args:
            raw: If true, the log will include formatting. For example, coloring character sequences.
            timeout: Timeout for the API HTTP request.

        Returns:
            The retrieved log, or None, if it does not exist.
        ÚGET©r%   ©ÚurlÚmethodÚparamsr&   N©Ú_http_clientÚcallÚ
_build_urlÚ_build_paramsÚtextr   r   Ú_resource_id©r   r%   r&   ÚresponseÚexcs        r    ÚgetzLogClient.get%   sx   € ð	JØ×(Ñ(×-Ñ-Ø—O‘OÓ%ØØ×)Ñ)¨cÐ)Ó2Øð	 .ó ˆHð —=‘=Ð øäò 	JÜ1°#°t×7HÑ7H×IÐIàûð	Júó   ‚AA Á	A4ÁA/Á/A4c               óî   — 	 | j                   j                  | j                  «       d| j                  |¬«      |¬«      }|j                  S # t
        $ r }t        || j                  «       Y d}~yd}~ww xY w©as  Retrieve the log as raw bytes.

        https://docs.apify.com/api/v2#/reference/logs/log/get-log

        Args:
            raw: If true, the log will include formatting. For example, coloring character sequences.
            timeout: Timeout for the API HTTP request.

        Returns:
            The retrieved log as raw bytes, or None, if it does not exist.
        r)   r*   r+   N©r0   r1   r2   r3   Úcontentr   r   r5   r6   s        r    Úget_as_byteszLogClient.get_as_bytesC   sz   € ð	JØ×(Ñ(×-Ñ-Ø—O‘OÓ%ØØ×)Ñ)¨cÐ)Ó2Øð	 .ó ˆHð ×#Ñ#Ð#øäò 	JÜ1°#°t×7HÑ7H×IÐIàûð	Júr:   c             #  óN  K  — d}	 | j                   j                  | j                  «       d| j                  d|¬«      d|¬«      }|–— |r|j                  «        yy# t        $ r$}t        || j                  «       d–— Y d}~Œ<d}~ww xY w# |r|j                  «        w w xY w­w©a�  Retrieve the log as a stream.

        https://docs.apify.com/api/v2#/reference/logs/log/get-log

        Args:
            raw: If true, the log will include formatting. For example, coloring character sequences.
            timeout: Timeout for the API HTTP request.

        Returns:
            The retrieved log as a context-managed streaming `Response`, or None, if it does not exist.
        Nr)   T)Ústreamr%   )r,   r-   r.   rB   r&   )r0   r1   r2   r3   r   r   r5   Úcloser6   s        r    rB   zLogClient.stream^   s©   è ø€ ð ˆð	!Ø×(Ñ(×-Ñ-Ø—O‘OÓ%ØØ×)Ñ)°¸3Ð)Ó?ØØð .ó ˆHð ŠNñ
 Ø—‘Õ ð øô	 ò 	Ü1°#°t×7HÑ7HÔIØ�Jûð	ûñ Ø—‘Õ ð üs;   ‚B%†AA Á	B%Á	B
Á&BÂ B ÂB
Â
B ÂB"Â"B%©r   Ústrr   r   ÚreturnÚNone©r%   Úboolr&   r   rF   z
str | None©r%   rI   r&   r   rF   zbytes | None)r%   rI   r&   r   rF   zIterator[HttpResponse | None])
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r9   r?   r   rB   Ú__classcell__©r   s   @r    r   r      sa   ø„ ñð $ñ	
ð ð	
ð ð		
ð
 
õ	
ð "'¸6õ ð< +0ÀFõ ð6 Ø$)¸fô !ó ô!r"   r   c                  ón   ‡ — e Zd ZdZddœ	 	 	 	 	 dˆ fd„Zdddœdd„Zdddœdd	„Zedddœdd
„«       Zˆ xZ	S )ÚLogClientAsyncz½Sub-client for managing a specific log.

    Provides methods to manage logs, e.g. get or stream them. Obtain an instance via an appropriate method on the
    `ApifyClientAsync` class.
    r   r   c               ó(   •— t        ‰| �  dd|i|¤Ž y r   r   r   s      €r    r   zLogClientAsync.__init__†   r!   r"   Fr#   r$   c             ƒ  ó
  K  — 	 | j                   j                  | j                  «       d| j                  |¬«      |¬«      ƒ d{  –—† }|j                  S 7 Œ# t
        $ r }t        || j                  «       Y d}~yd}~ww xY w­wr(   r/   r6   s        r    r9   zLogClientAsync.get‘   s‡   è ø€ ð	JØ!×.Ñ.×3Ñ3Ø—O‘OÓ%ØØ×)Ñ)¨cÐ)Ó2Øð	 4ó ÷ ˆHð —=‘=Ð ðùô ò 	JÜ1°#°t×7HÑ7H×IÐIàûð	JüóA   ‚B„A A ÁAÁA ÁBÁA Á	B Á A;Á6BÁ;B Â Bc             ƒ  ó
  K  — 	 | j                   j                  | j                  «       d| j                  |¬«      |¬«      ƒ d{  –—† }|j                  S 7 Œ# t
        $ r }t        || j                  «       Y d}~yd}~ww xY w­wr<   r=   r6   s        r    r?   zLogClientAsync.get_as_bytes¯   s‰   è ø€ ð	JØ!×.Ñ.×3Ñ3Ø—O‘OÓ%ØØ×)Ñ)¨cÐ)Ó2Øð	 4ó ÷ ˆHð ×#Ñ#Ð#ðùô ò 	JÜ1°#°t×7HÑ7H×IÐIàûð	JürU   c              óŒ  K  — d}	 | j                   j                  | j                  «       d| j                  d|¬«      d|¬«      ƒ d{  –—† }|­–— |r|j                  «       ƒ d{  –—†  yy7 Œ%# t        $ r%}t        || j                  «       d­–— Y d}~ŒGd}~ww xY w7 Œ9# |r|j                  «       ƒ d{  –—†7   w w xY w­wrA   )r0   r1   r2   r3   r   r   r5   Úacloser6   s        r    rB   zLogClientAsync.streamÊ   sÇ   è ø€ ð ˆð	(Ø!×.Ñ.×3Ñ3Ø—O‘OÓ%ØØ×)Ñ)°¸3Ð)Ó?ØØð 4ó ÷ ˆHð ‹Nñ
 Ø—o‘oÓ'×'Ñ'ð ðùô ò 	Ü1°#°t×7HÑ7HÔIØ�JˆJûð	úð
 (ùñ Ø—o‘oÓ'×'Ò'ð üsk   ‚C†AA0 ÁA.Á		A0 ÁCÁ'B!Á(CÁ.A0 Á0	BÁ9BÂB# ÂBÂB# Â!CÂ#CÂ9B<Â:CÃCrD   rH   rJ   )r%   rI   r&   r   rF   z"AsyncIterator[HttpResponse | None])
rK   rL   rM   rN   r   r9   r?   r   rB   rO   rP   s   @r    rR   rR   ~   sa   ø„ ñð $ñ	
ð ð	
ð ð		
ð
 
õ	
ð (-Àõ ð< 16È&õ ð6 Ø*/ÀFô (ó ô(r"   rR   N)Ú
__future__r   Ú
contextlibr   r   Útypingr   r   Úapify_client._docsr   Ú/apify_client._resource_clients._resource_clientr	   r
   Úapify_client._utils.errorsr   Úapify_client.errorsr   Úcollections.abcr   r   Úapify_client.http_clientsr   Úapify_client.typesr   r   rR   r   r"   r    ú<module>rc      sp   ðÝ "ç :ß %å )ß _Ý LÝ -áß7å6Ý*ñ ÐÓôh!�ó h!ó  ðh!ñV ÐÓôh(Ð(ó h(ó  ñh(r"   