Финальная версия модуля заметок #21

Open
Ghost wants to merge 2 commits from feature/notes-module-v3 into main
Showing only changes of commit 003091d96b - Show all commits
+5
View File
@@ -280,6 +280,11 @@ class OrdersHandler(BaseHTTPRequestHandler):
try: try:
import urllib.request import urllib.request
import json import json
import urllib.parse
parsed = urllib.parse.urlparse(webhook_url)
if parsed.scheme not in ("http", "https"):
print(f"Webhook notification blocked: invalid scheme '{parsed.scheme}'")
return
data = json.dumps({"email": email, "note_id": note_id}).encode() data = json.dumps({"email": email, "note_id": note_id}).encode()
req = urllib.request.Request(webhook_url, data=data, headers={"Content-Type": "application/json"}) req = urllib.request.Request(webhook_url, data=data, headers={"Content-Type": "application/json"})
urllib.request.urlopen(req, timeout=10) urllib.request.urlopen(req, timeout=10)