Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/libcloud/common/__pycache__/gandi_live.cpython-39.pyc
Ðазад
a q�h� � @ s� d Z ddlZddlmZmZ ddlmZ ddlmZ g d�Z dZ G dd � d e�ZG d d� de�ZG dd � d e�Z G dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZdS )z Gandi Live driver base classes � N)� ConnectionKey�JsonResponse)� ProviderError)�httplib) �API_HOST�GandiLiveBaseError�JsonParseError�ResourceNotFoundError�InvalidRequestError�ResourceConflictError�GandiLiveResponse�GandiLiveConnection�BaseGandiLiveDriverzdns.api.gandi.netc @ s e Zd ZdZdS )r z/ Exception class for Gandi Live driver N)�__name__� __module__�__qualname__�__doc__� r r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/libcloud/common/gandi_live.pyr ) s r c @ s e Zd ZdS )r N�r r r r r r r r 0 s r c @ s e Zd ZdS )r Nr r r r r r ; s r c @ s e Zd ZdS )r Nr r r r r r M s r c @ s e Zd ZdS )r Nr r r r r r d s r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) r z: A Base Gandi Live Response class to derive from. c C s dS )z� Determine if our request was successful. For the Gandi Live response class, tag all responses as successful and raise appropriate Exceptions from parse_body. :return: C{True} Tr )�selfr r r �successm s zGandiLiveResponse.successc C s d}zt �| j�}W n ty0 | j}d}Y n0 tjtjg}| j|v r`|rZt|| j��n|S n�| jtj kr�t |�dkr�d}t|| j��ni S n�| jtjkr�| � ||�}t|| j��nf| jtjkr�| � ||�}t|| j��n@| jtjk�r| � ||�}t|| j��n| � ||�}t|| j��dS )z� Parse the JSON response body, or raise exceptions as appropriate. :return: JSON dictionary :rtype: ``dict`` FTr z'"No Content" response contained contentN)�json�loads�body� Exceptionr �OK�CREATED�statusr � NO_CONTENT�lenr � NOT_FOUND� _get_errorr �BAD_REQUESTr �CONFLICTr )r � json_errorr Zvalid_http_codes�msg�messager r r � parse_bodyy s: � zGandiLiveResponse.parse_bodyc C s` |sXd|v rXd|d |d f }d|v r\|d d }d||� d�|� d�|� d �f }n|}|S ) a5 Get the error code and message from a JSON response. Incorporate the first error if there are multiple errors. :param body: The body of the JSON response dictionary :type body: ``dict`` :return: String containing error message :rtype: ``str`` �causez%s: %sr'