D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.9
/
site-packages
/
ipaclient
/
plugins
/
__pycache__
/
Filename :
otptoken.cpython-39.pyc
back
Copy
a }�f� � @ s d dl mZ d dlZd dlmZ d dlmZmZmZm Z d dlm Z d dlmZm Z d dlmZ d dlmZ d d lmZ d d lmZ d dlZd dlZd dlZd dlmZ d dlZd dlZejr�eZ e� Z!e!ddd �G dd� de��Z"G dd� dej#j$�Z$e!� G dd� de��Z%dS )� )�print_functionN)�MethodOverride)�api�Str�Password�_)�errors)�add_message�ResultFormattingError)�Registry)�Local)�create_https_connection)�API_VERSION)�StringIOT)�overrideZno_failc s$ e Zd Zdd� Z� fdd�Z� ZS )�otptoken_addc C s� t � }t�� }|�|� |�� |j|dd� ttjdd �}|d u rNt � d�}z|�� �|�}W n, t y� t||ttd�d�d� Y d S 0 tj�� r�| jjj�� }t|�� d �} | |kr�t||ttd�d�d� |S )NF)�out�tty�encodingzuUnable to display QR code using the configured output encoding. Please use the token URI to configure your OTP device��messager zRQR code width is greater than that of the output tty. Please resize your terminal.)r �qrcodeZQRCodeZadd_dataZmake�print_ascii�getattr�sys�stdout�locale�getpreferredencoding�getvalue�encode�UnicodeErrorr r r �isattyr ZBackend�textuiZ get_tty_width�len� splitlines) �self�output�uri�versionZ qr_output�qrr Zqr_codeZoutput_widthZ qr_code_width� r* �>/usr/lib/python3.9/site-packages/ipaclient/plugins/otptoken.py�_get_qrcode0 sB �� ��� zotptoken_add._get_qrcodec s� d|v r n| j jjrd|d<