File: //lib/python3/dist-packages/uaclient/http/__pycache__/serviceclient.cpython-38.pyc
U
��Jh� � @ st d dl Z d dlZd dlZd dlZd dlmZmZmZ d dlm Z d dl
mZmZm
Z
mZmZ G dd� de jd�ZdS )� N)�Any�Dict�Optional)� urlencode)�config�http�system�util�versionc @ s� e Zd ZdZdZeejed�dd���Z de
ej dd�dd�Z
d d
� Zdee
e ejd�d
d�Zed�dd�Zee
ej d�dd�ZdS )�UAServiceClient� N)�returnc C s dS )z@String in subclasses, the UAConfig attribute containing base urlN� ��selfr r �=/usr/lib/python3/dist-packages/uaclient/http/serviceclient.py�cfg_url_base_attr s z!UAServiceClient.cfg_url_base_attr)�cfgr
c C s |st �� | _n|| _d S �N)r �UAConfigr )r r r r r �__init__ s zUAServiceClient.__init__c C s d� t�� �ddd�S )NzUA-Client/{}�application/json)z
user-agentZaccept�content-type)�formatr
Zget_versionr r r r �headers s �zUAServiceClient.headersT)�log_response_body�timeoutr
c C s� |� d�}|s| �� }|�d�dkr>|r>tj|tjd��d�}t� t
| j| j�|�}| �
|�} | rf| S |r�dd� t|�� �D �}
|dt|
� 7 }|d k r�|n| j}tj||||||d �S )
N�/r r )�clszutf-8c S s i | ]\}}|d k r||�qS r r )�.0�k�vr r r �
<dictcomp>>