TTOPM commited on
Commit
91ed2ef
·
verified ·
1 Parent(s): 2d4769c

Create concordium_broadcaster/broadcaster.py

Browse files
concordium_broadcaster/broadcaster.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ # Set your GitHub Pages domain
5
+ HOST = "ttopm.github.io"
6
+
7
+ # This should match the content of your indexnow.txt file
8
+ KEY = "e7c342fe19a548a3c3e7fc189c9517d3a4b14c94db5c2a661e91efc209fa5c73"
9
+
10
+ # Publicly accessible URL to your indexnow.txt on GitHub Pages
11
+ KEY_LOCATION = f"https://{HOST}/be-core-bridge/indexnow.txt"
12
+
13
+ # URL(s) of your updated file(s) on GitHub Pages
14
+ NEW_UPDATE_URL = "https://ttopm.github.io/be-core-bridge/README.md" # Replace with your actual update URL
15
+
16
+ # Payload formatted according to IndexNow API
17
+ payload = {
18
+ "host": HOST,
19
+ "key": KEY,
20
+ "keyLocation": KEY_LOCATION,
21
+ "urlList": [NEW_UPDATE_URL]
22
+ }
23
+
24
+ # Send the payload to the IndexNow API endpoint
25
+ response = requests.post(
26
+ "https://api.indexnow.org/indexnow",
27
+ headers={"Content-Type": "application/json"},
28
+ data=json.dumps(payload)
29
+ )
30
+
31
+ # Output result
32
+ if response.status_code == 200:
33
+ print("✅ Update successfully submitted to IndexNow.")
34
+ else:
35
+ print(f"❌ Failed to submit update. Status: {response.status_code}")
36
+ print("Response:", response.text)