�
!V1f� � � � d dl Z d dlZd dlZd dlZd dlmZmZmZ d dlm Z d dl
mZmZm
Z
mZmZ G d� de j �� Zy)� N)�Any�Dict�Optional)� urlencode)�config�http�system�util�versionc �� � e Zd ZdZdZeej defd�� � Z dde
ej ddfd�Z
d� Z dded e
e dej$ fd
�Zdefd�Zdede
ej$ fd
�Zy)�UAServiceClient� N�returnc � � y)z@String in subclasses, the UAConfig attribute containing base urlN� ��selfs �=/usr/lib/python3/dist-packages/uaclient/http/serviceclient.py�cfg_url_base_attrz!UAServiceClient.cfg_url_base_attr s � �
� �cfgc �J � |st j � | _ y || _ y �N)r �UAConfigr )r r s r �__init__zUAServiceClient.__init__ s � �����(�D�H��D�Hr c �P � dj t j � � ddd�S )NzUA-Client/{}�application/json)z
user-agent�accept�content-type)�formatr �get_versionr s r �headerszUAServiceClient.headers s) � �(�/�/��0C�0C�0E�F�(�.�
�
r �log_response_body�timeoutc �T � |j d� }|s| j � }|j d� dk( r6|r4t j |t
j �� j d� }t j t | j | j � |� }| j |� } | r| S |r@t |j � � D �
�ci c] \ }
}|�� |
|��
}}
}|dt! |� z z
}|�|n| j" |