| Current Path : /lib/python3.6/site-packages/CloudFlare/__pycache__/ |
| Current File : //lib/python3.6/site-packages/CloudFlare/__pycache__/cloudflare.cpython-36.pyc |
3
O�/f_� � @ s� d Z ddlZddlZddlmZmZ ddlmZ ddlm Z m
Z
ddlmZmZ ddl
m
Z
dd lmZ dd
lmZ ddlmZmZ dZd
ZdZdZG dd� d�ZG dd� de�ZG dd� de�ZdS )z� Cloudflare v4 API
A Python interface Cloudflare's v4 API.
See README.md for detailed/further reading.
Copyright (c) 2016 thru 2024, Cloudflare. All rights reserved.
� N� )� CFnetwork�CFnetworkError)�CFlogger)�
user_agent�
build_curl)�read_configs�ReadConfigError)�api_v4)�
api_extras)�api_decode_from_openapi)�CloudFlareAPIError�CloudFlareInternalErrorz$https://api.cloudflare.com/client/v4z?https://github.com/cloudflare/api-schemas/raw/main/openapi.json� c @ s e Zd ZdZG dd� d�ZG dd� d�ZG dd� de�ZG dd � d e�ZG d
d� de�ZG dd
� d
e�Z G dd� de�Z
edd� �Zdd�dd�Z
ddd�dd�Zdd� Zdd� Zd4dd �Zd5d!d"�Zd6d$d%�Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� ZdS )7�
CloudFlarea� A Python interface Cloudflare's v4 API.
:param email: Authentication email (if not provided by config methods).
:param key: Authentication key (if not provided by config methods).
:param token: Authentication token (if not provided by config methods).
:param certtoken: Authentication certtoken (if not provided by config methods).
:param debug: Debug is enabled by setting to True.
:param raw: Set to True to force raw responses so you can see paging.
:param use_sessions: The default is True; rarely needs changing.
:param profile: Profile name (default is "CloudFlare").
:param base_url: Rarely changed Cloudflare API URL.
:param global_request_timeout: Timeout value (default is 5 seconds).
:param max_request_retries: Number of retry times (default is 5 times).
:param http_headers: Additional HTTP headers (as a list).
:return: New instance of CloudFlare()
A Python interface Cloudflare's v4 API.
c @ s� e Zd ZdZdd� Zdd� Zd#dd�Zd d
� Zdd� Zd$d
d�Z d%dd�Z
d&dd�Zd'dd�Zd(dd�Z
dd� Zdd� Zdd� Zdd� Zd)dd �Zd!d"� ZdS )*zCloudFlare._v4basez :meta private: c C s� d| _ || _d|kr|d nd| _d|kr2|d nd| _d|krH|d nd| _d|kr^|d nd| _d|krt|d nt| _d|kr�|d nt| _ |d | _
|d | _d
|kr�|d
nt| _
d|kr�|d nt| _yt| j
�| _
W n ttfk
r� t| _
Y nX yt| j�| _W n ttfk
�r0 t| _Y nX d|k�rD|d nd| _|d
| _t| j| j
| jd�| _ t� | _d|k�r�|d �r�t|d �j� nd| _dS )z :meta private: N�email�key�token� certtoken�base_url�openapi_url�raw�use_sessions�global_request_timeout�max_request_retries�http_headers�profile)r r r �debug)�network�config� api_email�api_key� api_token�
api_certtoken�BASE_URLr �OPENAPI_URLr r r �DEFAULT_GLOBAL_REQUEST_TIMEOUTr �DEFAULT_MAX_REQUEST_RETRIESr �int� TypeError�
ValueError�additional_http_headersr r r r Z getLogger�logger)�selfr � r. � /usr/lib/python3.6/cloudflare.py�__init__3 s8
zCloudFlare._v4base.__init__c C s | j r| ` d | _ d S )N)r )r- r. r. r/ �__del__[ s zCloudFlare._v4base.__del__Nc C s� i | _ | j| j d<