o
    BZœc”  ã                   @   sP   d dl mZ d dlmZ d dlmZ d dlmZm	Z	m
Z
mZ G dd„ deƒZdS )é    )Úsettings)ÚImproperlyConfigured)ÚSession)ÚDEFAULT_NO_REQUEST_IDÚ"OUTGOING_REQUEST_ID_HEADER_SETTINGÚREQUEST_ID_HEADER_SETTINGÚlocalc                       s(   e Zd Z‡ fdd„Z‡ fdd„Z‡  ZS )r   c                    s\   t ttƒrtttƒ| _nt ttƒrtttƒ| _n	tdtttf ƒ‚tt	| ƒj
|i |¤Ž d S )Nz;The %s or %s settings must be configured in order to use %s)Úhasattrr   r   ÚgetattrÚrequest_id_headerr   r   Ú__name__Úsuperr   Ú__init__)ÚselfÚargsÚkwargs©Ú	__class__© úL/var/www/chikooza/env/lib/python3.10/site-packages/log_request_id/session.pyr   	   s   

þÿzSession.__init__c                    s@   zt j}| jr||j| j< W n	 ty   Y nw tt| ƒ |¡S )z=Include the request ID, if available, in the outgoing request)r   Ú
request_idr   ÚheadersÚAttributeErrorr   r   Úprepare_request)r   Úrequestr   r   r   r   r      s   €ÿzSession.prepare_request)r   Ú
__module__Ú__qualname__r   r   Ú__classcell__r   r   r   r   r      s    r   N)Údjango.confr   Údjango.core.exceptionsr   Úrequestsr   ÚBaseSessionÚlog_request_idr   r   r   r   r   r   r   r   Ú<module>   s
    