From 8cac19570f72d61c3d55d9468ebad86f6bb29930 Mon Sep 17 00:00:00 2001 From: Sayyid Hamid Mahdavi Date: Sun, 22 Nov 2020 16:08:48 +0330 Subject: [PATCH] set time out --- apps/users/tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/users/tasks.py b/apps/users/tasks.py index a13c2f5..a82f7d3 100644 --- a/apps/users/tasks.py +++ b/apps/users/tasks.py @@ -20,5 +20,9 @@ def send_notification(phone_number=None, 'phone_number': phone_number, "body": f'{title}:\n{body}' } - print(client.request(required_scopes=SCOPES, url=f'{settings.BASE_NOTIFICATION_URL}/notifications/', data=data, - method='post').text) + try: + print(client.request(required_scopes=SCOPES, url=f'{settings.BASE_NOTIFICATION_URL}/notifications/', data=data, + method='post', timeout=5).text) + except Exception as e: + print(e) +