관리-도구
편집 파일: rpcServer.cpython-36.pyc
3 e�$g�+ � @ sZ d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm Z d dl mZ d dl mZ d d l mZ y$d dlZd dlZd dlZd dlZW n< ek r� d dljZd dljZd dljZd dljZY nX d dlZejd dd�Zeed ��seje_ejZ dd� Z!G dd� dej"�Z#G dd� d�Z$ddd�Z%ddd�Z&dd� Z'dS )� N)�config)� clientCaps)� up2dateLog)� up2dateErrors)�up2dateUtils)�SSL)�rpclib)� raise_with_tbzrhn-client-toolsT)Zfallback�ugettextc C s t | � d S )N)�print)�msg� r �/usr/lib/python3.6/rpcServer.py�stdoutMsgCallback$ s r c @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�RetryServerc C s || _ d S )N)� serverList)�selfr r r r � addServerList) s zRetryServer.addServerListc C s� t j� | _�xry| j||�}W �nX tjk r: � Y �n@ tjk rR � Y �n( tj k r� | jj d� ttd�� t jd� Y n� | jj� }|d kr�| jj� � d| j }|dt j� d t j� d f }|d| jj� }| jj |� tj| jj� �}|d }|d | _|d | _|j� }|d k�rDttjd | �� | j| _|| _| jj� | _| j�sld| _d| _wY nX P qW |S )Nz,Error: Server Unavailable. Please try later.� z!An error occurred talking to %s: z%s %s r zTrying the next serverURL: %s � �http�httpsz%Redirected to unsupported protocol %sz/RPC2���)r r )r �initLog�logZ_requestr ZInvalidRedirectionError� xmlrpclibZFault�httplibZ BadStatusLine�log_mer �_�sys�exitr �next�resetServerIndexZ_host�exc_info�server�urlparseZurlsplitZ_handler�lowerr Z _orig_handlerZ_typeZ_uriZ_allow_redirect)r Z methodnameZparams�retr$ r Z parse_res�typr r r � _request1, sN zRetryServer._request1c C s t jj| j|�S )N)r r Z_Methodr) )r �namer r r �__getattr__^ s zRetryServer.__getattr__N)�__name__� __module__�__qualname__r r) r+ r r r r r ( s 2r c @ s0 e Zd Zg fdd�Zdd� Zdd� Zdd� Zd S ) � ServerListc C s || _ d| _d S )Nr )r �index)r Z serverlistr r r �__init__e s zServerList.__init__c C s | j | j | _| jS )N)r r0 Z serverurl)r r r r r$ i s zServerList.serverc C s( | j d | _ | j t| j�kr d S | j� S )Nr )r0 �lenr r$ )r r r r r! n s zServerList.nextc C s d| _ d S )Nr )r0 )r r r r r"