Your IP : 216.73.216.86


Current Path : /lib/python3.6/site-packages/CloudFlare/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/CloudFlare/__pycache__/read_configs.cpython-36.opt-1.pyc

3

�9�e��@s\dZddlZddlZyddlZWnek
r<ddlZYnXGdd�de�Zddd�ZdS)z+ reading the config file for Cloudflare API�Nc@seZdZdZdS)�ReadConfigErrorz errors for read_configsN)�__name__�
__module__�__qualname__�__doc__�rr�"/usr/lib/python3.6/read_configs.pyrsrcCs�ddddddddd�}tjd�dk	r.tjd�ntjd�|d<tjd�dk	rTtjd�ntjd�|d<tjd	�dk	rztjd	�ntjd
�|d<tjd�dk	r�tjd�ntjd
�|d<tjd�dk	r�tjd�ntjd�|d<tjd�dk	r�tjd�ntjd�|d<tjd�dk	�rtjd�ntjd�|d<tjd�|d<tjd�|d<tjd�|d<tj�}y$|jdtjjd�tjjd �g�Wn$tk
�r�td!d�d�YnXt	|j
��d"k�r�|dk	�r�t	|�d"k�r�td#|�d�|dk�r|jd$��r�d$}|jd%��rd%}|dk�rd$}||d&<t	|�d"k�r�t	|j
��d"k�r�|j|��s^td'|d(j|j
��f�d��x.d8D�]$}yz|j
||�}|dk�r�tjd)d*|�||<n&|dk�r�|||<ntjd)d+|�||<||dk�s�||d+k�r�|j|�Wntjtjfk
�rYnXx�d9D]z}|d1|}yH|j
||�}tjd)d+|�||<||dk�sX||d+k�rb|j|�Wntjtjfk
�r�YnX�qW�qfWd|k�r�|ddk	�r�|dj�jd*�|d<d|k�r`|ddk	�r`d2d3�|djd4�D�|d<xl|dD]`}y|jd5d6�\}}	Wn$tk
�r8td7|�d�YnXt	|j��d"k�r�td7|�d��q�WxXt|j��D]H}
||
dk�s�||
d+k�rny|j|
�Wntk
�r�YnX�qnW|S):z+ reading the config file for Cloudflare APIN)�email�key�token�	certtoken�extras�base_url�openapi_url�profileZCLOUDFLARE_EMAILZCF_API_EMAILr	ZCLOUDFLARE_API_KEYZ
CF_API_KEYr
ZCLOUDFLARE_API_TOKENZCF_API_TOKENrZCLOUDFLARE_API_CERTKEYZCF_API_CERTKEYrZCLOUDFLARE_API_EXTRASZ
CF_API_EXTRASr
ZCLOUDFLARE_API_URLZ
CF_API_URLrZCLOUDFLARE_OPENAPI_URLZCF_OPENAPI_URLrZ!CLOUDFLARE_GLOBAL_REQUEST_TIMEOUT�global_request_timeoutZCLOUDFLARE_MAX_REQUEST_RETRIES�max_request_retriesZCLOUDFLARE_HTTP_HEADERS�http_headersz.cloudflare.cfgz~/.cloudflare.cfgz~/.cloudflare/cloudflare.cfgz%s: configuration file errorrz>%s: configuration section provided however config file missingZ
CloudFlareZ
CloudflarerzR%s: configuration section missing - configuration file only has these sections: %s�,z\s+� ��get�patch�post�put�delete�.cSsg|]}t|�dkr|�qS)r)�len)�.0�hrrr�
<listcomp>csz read_configs.<locals>.<listcomp>�
�:�z%s: header syntax error)
r	r
rrr
rrrrr)rrrrr)�os�getenv�configparser�ConfigParser�read�path�
expanduser�OSErrorrrZsectionsZhas_section�joinr�re�sub�popZ
NoOptionErrorZNoSectionError�strip�split�
ValueError�sorted�keys�KeyError)r�configZcpZoptionZconfig_value�methodZoption_for_methodr�t�v�xrrr�read_configss�&&&&&&(
*

 



r;)N)	rr$r-r&�ImportErrorr'�	Exceptionrr;rrrr�<module>s