File: //home/arjun/projects/buyercall/buyercall/integrations/__pycache__/push_engage.cpython-310.pyc
o
we � @ s, d dl Z d dlZe�e�ZG dd� d�ZdS )� Nc @ sR e Zd ZdZdZdZdZdZg d�Zg d�Z dd� Z
dd d
�Zdd� Zd
d� Z
dS )�
PushEngageAPIz7
Send Push Notifications using PushEngage API.
� � N)�notification_url�notification_title�notification_message� image_url�include_segments�exclude_segments�include_countries�exclude_countries�include_states�include_cities�include_device_types�include_browsers� from_date�to_date�notification_expiry�notification_type�subscriber_hash�
big_image_url�valid_from_utc)�MISSED_CALL�
VOICE_MAIL�TEXT_MESSAGE�FORM_SUBMISSION�PASSWORD_CHANGEc C s$ |j �dd�| _|j �dd�| _dS )z�
Set the endpoint and api key for the push engage api request.
:param app: flask app
:return None: None
�PUSHENGAGE_ENDPOINTz.https://api.pushengage.com/apiv1/notifications�PUSHENGAGE_API_KEYz$871e2367-0809-4b22-8dd2-32475e4580f3N)�config�get�endpoint�api_key)�self�app� r% �D/home/arjun/projects/buyercall/buyercall/integrations/push_engage.py�init_app s zPushEngageAPI.init_appc
C s| z$d}t j| j|||d�}|rd}|d8 }|s"|dkr"| �|||� |W S ty= } z
t�|� � W Y d }~d S d }~ww )NF)�url�data�headers�timeoutT� r )�requests�postr! �send_request� Exception�log�error)r# r) r* �retriesr+ �success�response�er% r% r&