File: //lib/python3/dist-packages/uaclient/http/__pycache__/serviceclient.cpython-310.pyc
o
nHJe� � @ 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 ZdZdZeejdefdd���Z dde
ej ddfdd�Z
d d
� Z dded
e
e dejfdd�Zdefdd�Zdede
ej fdd�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�cfgc C s |s t �� | _d S || _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-agent�accept�content-type)�formatr
�get_versionr r r r �headers s �zUAServiceClient.headersT�log_response_body�timeoutc C s� |� d�}|s| �� }|�d�dkr|rtj|tjd��d�}t� t
| j| j�|�}| �
|�} | r3| S |rHdd� t|�� �D �}
|dt|
� 7 }|d urN|n| j}tj||||||d �S )
N�/r r )�clszutf-8c S s i | ]\}}|d ur||�qS r r )�.0�k�vr r r �
<dictcomp>>