
    _Og`                     f    S SK JrJrJrJr  S SKrS SKrS SKrS SKrS SK	rSSK
Jr   " S S\5      rg)    )DictListOptionalUnionN   )CloudflareErrorc                   L   \ rS rSrSrS \R                  \R                  S.rSSSSS\	" 5       4S\
S\\   S	\\   S
\S\\   S\\   S\\   4S jjrS\\\4   4S jrS\4S jrS\R*                  R,                  4S jrS\R0                  R2                  4S jrS\4S jrSrg)
APIRequest   z.
Class to make requests to the FlightRadar24.
c                     U $ )N )xs    Z/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/FlightRadar24/request.py<lambda>APIRequest.<lambda>   s    a    ) brgzipN   urlparamsheaderstimeoutdatacookiesexclude_status_codesc                    Xl         UUUUUS.U l        Uc  [        R                  O[        R                  nU(       aI  USSR                  UR                  5        V	V
s/ s H  u  pSR                  X5      PM     sn
n	5      -   -  nU" XXeUS9U l        U R                  5       S:X  a  [        SU R                  S	9eU R                  5       U;  a  U R                  R                  5         ggs  sn
n	f )
a  
Constructor of the APIRequest class.

:param url: URL for the request
:param params: params that will be inserted on the URL for the request
:param headers: headers for the request
:param data: data for the request. If "data" is None, request will be a GET. Otherwise, it will be a POST
:param cookies: cookies for the request
:param exclude_status_codes: raise for status code except those on the excluded list
)r   r   r   r   r   N?&z{}={})r   r   r   r   i  zHAn unexpected error has occurred. Perhaps you are making too many calls?)messageresponse)r   request_paramsrequestsgetpostjoinitemsformat_APIRequest__responseget_status_coder   raise_for_status)selfr   r   r   r   r   r   r   request_methodkvs              r   __init__APIRequest.__init__   s    (  
 *.8==3#6<<>)Z>41'..*>>)Z [[[3(wcjk!S(!b 
 !)==OO,,. > *[s   C,returnc                 2   U R                   R                  nU R                   R                  R                  SS5      nU R                   R                  S   nU R                  U   " U5      nSU;   a  [        R                  " U5      $ U$ ! [
         a     N*f = f)z/
Return the received content from the request.
zContent-Encodingr   zContent-Typezapplication/json)r*   contentr   r%   _APIRequest__content_encodings	Exceptionjsonloads)r-   r5   content_encodingcontent_types       r   get_contentAPIRequest.get_contentE   s     //))??22667I2N..~> //0@A'JW -::g&& $s   B	 	
BBc                 J    U R                   R                  R                  5       $ )z/
Return the received cookies from the request.
)r*   r   get_dictr-   s    r   get_cookiesAPIRequest.get_cookiesX   s     &&//11r   c                 .    U R                   R                  $ )z%
Return the headers of the response.
)r*   r   r@   s    r   get_headersAPIRequest.get_headers^   s     &&&r   c                     U R                   $ )z&
Return the received response object.
)r*   r@   s    r   get_response_objectAPIRequest.get_response_objectd   s     r   c                 .    U R                   R                  $ )z)
Return the status code of the response.
)r*   status_coder@   s    r   r+   APIRequest.get_status_codej   s     ***r   )
__responser#   r   )__name__
__module____qualname____firstlineno____doc__brotli
decompressr   r6   liststrr   r   intr   r1   r   bytesr<   rA   r$   
structuresCaseInsensitiveDictrD   modelsResponserG   r+   __static_attributes__r   r   r   r
   r
      s      "&"&#"&*.&*/*/ */ $	*/
 */ tn*/ $*/ #3i*/XU4;/ &2T 2'X00DD 'X__%=%= + +r   r
   )typingr   r   r   r   rR   r8   r   r$   requests.structureserrorsr   objectr
   r   r   r   <module>ra      s-    / .      #_+ _+r   