File: //usr/local/CyberCP/lib/python3.10/site-packages/examples/__pycache__/example_zones.cpython-310.pyc
o
�h@ � @ sX d Z ddlZddlZddlZej�dej�d�� ddlZdd� Ze dkr*e� dS dS )�Cloudflare API code - example� Nz..c s< zt jd } | dd�}W n
ty ddi}Y nw t�� }z |jj|d�}W n3 tjjyC } ztd||f � W Y d}~nd}~w t yZ } ztd| � W Y d}~nd}~ww t
|d d
� d�D ]�}|d } |d
}|d }d|d v r~|d d }n
d|d d d }|d d } td|| ||| f � z |jj�|�}
W n tjjy� } zt j
�d||f � W Y d}~qcd}~ww t�d| d �� t
|
� fdd
�d�}
|
D ]<}|d }|d }
d|v r�|d }nd}d|v r�|d }nd}|d }|dk�rd}n|d
}td||||
||f � q�td� qctd� dS )r � )�name�per_pager �2 )�paramsz/zones %d %s - api call failedNz!/zones.get - %s - api call failedc S s | d S )Nr � ��vr r �I/usr/local/CyberCP/lib/python3.10/site-packages/examples/example_zones.py�<lambda> s zmain.<locals>.<lambda>)�keyr �id�type�email�owner�"�planz%s %-35s %-30s %-20s %sz+/zones/dns_records %d %s - api call failed
z\.*�$c s � � d| d �d | d S )N� r �_r )�subr ��progr r r 3 s �contentr �priority�ttl� secondaryz %s %60s %6d %-5s %4s %sr )�sys�argv�
IndexError�
CloudFlare�zones�get�
exceptions�CloudFlareAPIError�exit� Exception�sorted�print�dns_records�stderr�write�re�compile)� zone_namer �cfr"