0.12.35 fix webpush

This commit is contained in:
SDE
2024-04-15 17:19:12 +03:00
parent fd70e388a7
commit 698f4578fc
3 changed files with 41 additions and 8 deletions

View File

@@ -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

View File

@@ -126,12 +126,23 @@ def search_matches(for_routes=None):
if found_routes: if found_routes:
msg = f'found routes for send messages = {found_routes.count()}' msg = f'found routes for send messages = {found_routes.count()}'
data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type) try:
msg = send_push_message_for_found_matches_routes(route, data_Dict) data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type)
if msg: msg = send_push_message_for_found_matches_routes(route, data_Dict)
if msg:
log += msg
except Exception as e:
msg = f'<br>\n! search_matches Error send_push_message_for_found_matches_routes = {str(e)}'
print(msg)
log += 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'<br>\n! search_matches Error send_mail_found_matches_routes = {str(e)}'
print(msg)
log += msg log += msg
except Exception as e: except Exception as e:

View File

@@ -29,10 +29,12 @@ DEBUG = True
ALLOWED_HOSTS = ["*"] ALLOWED_HOSTS = ["*"]
# https://web-push-codelab.glitch.me/
WEBPUSH_SETTINGS = { WEBPUSH_SETTINGS = {
"VAPID_PUBLIC_KEY": "BKS8byh3MucwCF2h06JY9oey1s1RYII09j-j3ehI3qTYhs965UHv0qNPl-jFjQBbIJCvjVXm9RW6t_oJJK8yMOk", # "VAPID_PUBLIC_KEY": "BKS8byh3MucwCF2h06JY9oey1s1RYII09j-j3ehI3qTYhs965UHv0qNPl-jFjQBbIJCvjVXm9RW6t_oJJK8yMOk",
"VAPID_PRIVATE_KEY": "f5NMgOntBtRqsyeKwEzloK-051ggMnZGF_GFimERY0w", # "VAPID_PRIVATE_KEY": "f5NMgOntBtRqsyeKwEzloK-051ggMnZGF_GFimERY0w",
"VAPID_PUBLIC_KEY": "BNf5y-99x5UNoaK98VAPKzZOevJHnak-LUmiQFu_r0i8tO3z7TPsto0DKHzNUO76ejNVWjmpL3UoavIsa3C3NEs",
"VAPID_PRIVATE_KEY": "4m8Z-bmT7ofb4bxM488eqFUksqnBUGzZh2rBrfSvPGo",
"VAPID_ADMIN_EMAIL": "admin@tripwb.com" "VAPID_ADMIN_EMAIL": "admin@tripwb.com"
} }