From 698f4578fc2f6a56f826cf3f740ecddb6a973392 Mon Sep 17 00:00:00 2001 From: SDE Date: Mon, 15 Apr 2024 17:19:12 +0300 Subject: [PATCH] 0.12.35 fix webpush --- .../pay_systems/DVL_Group_kaz/api/funcs.py | 20 ++++++++++++++++++ RoutesApp/search_matches.py | 21 ++++++++++++++----- TWB/settings.py | 8 ++++--- 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 BaseModels/pay_systems/DVL_Group_kaz/api/funcs.py diff --git a/BaseModels/pay_systems/DVL_Group_kaz/api/funcs.py b/BaseModels/pay_systems/DVL_Group_kaz/api/funcs.py new file mode 100644 index 0000000..9bbe71e --- /dev/null +++ b/BaseModels/pay_systems/DVL_Group_kaz/api/funcs.py @@ -0,0 +1,20 @@ +import requests + +def ping(): + + req_str = f'https://developerhub.alfabank.by:8273/partner/1.0.1/public/nationalRates{code_str}{date_str}' + data = {} + headers = { + 'content-type': 'application/json' + } + + try: + msg = f'GET {req_str}' + print(msg) + res = requests.get(req_str, data=data, headers=headers) + msg = f'answer received = {str(res)}' + print(msg) + except Exception as e: + msg = f'Exception GET {req_str} = {str(e)} ({str(res)})' + print(msg) + res = None \ No newline at end of file diff --git a/RoutesApp/search_matches.py b/RoutesApp/search_matches.py index 81b1994..3e9751f 100644 --- a/RoutesApp/search_matches.py +++ b/RoutesApp/search_matches.py @@ -126,12 +126,23 @@ def search_matches(for_routes=None): if found_routes: msg = f'found routes for send messages = {found_routes.count()}' - data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type) - msg = send_push_message_for_found_matches_routes(route, data_Dict) - if msg: + try: + data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type) + msg = send_push_message_for_found_matches_routes(route, data_Dict) + if msg: + log += msg + except Exception as e: + msg = f'
\n! search_matches Error send_push_message_for_found_matches_routes = {str(e)}' + print(msg) log += msg - msg = send_mail_found_matches_routes(route, data_Dict) - if msg: + + try: + msg = send_mail_found_matches_routes(route, data_Dict) + if msg: + log += msg + except Exception as e: + msg = f'
\n! search_matches Error send_mail_found_matches_routes = {str(e)}' + print(msg) log += msg except Exception as e: diff --git a/TWB/settings.py b/TWB/settings.py index 2c657a1..5cfa9f2 100644 --- a/TWB/settings.py +++ b/TWB/settings.py @@ -29,10 +29,12 @@ DEBUG = True ALLOWED_HOSTS = ["*"] - +# https://web-push-codelab.glitch.me/ WEBPUSH_SETTINGS = { - "VAPID_PUBLIC_KEY": "BKS8byh3MucwCF2h06JY9oey1s1RYII09j-j3ehI3qTYhs965UHv0qNPl-jFjQBbIJCvjVXm9RW6t_oJJK8yMOk", - "VAPID_PRIVATE_KEY": "f5NMgOntBtRqsyeKwEzloK-051ggMnZGF_GFimERY0w", + # "VAPID_PUBLIC_KEY": "BKS8byh3MucwCF2h06JY9oey1s1RYII09j-j3ehI3qTYhs965UHv0qNPl-jFjQBbIJCvjVXm9RW6t_oJJK8yMOk", + # "VAPID_PRIVATE_KEY": "f5NMgOntBtRqsyeKwEzloK-051ggMnZGF_GFimERY0w", + "VAPID_PUBLIC_KEY": "BNf5y-99x5UNoaK98VAPKzZOevJHnak-LUmiQFu_r0i8tO3z7TPsto0DKHzNUO76ejNVWjmpL3UoavIsa3C3NEs", + "VAPID_PRIVATE_KEY": "4m8Z-bmT7ofb4bxM488eqFUksqnBUGzZh2rBrfSvPGo", "VAPID_ADMIN_EMAIL": "admin@tripwb.com" }