Skip to content

Commit

Permalink
Update sitemaps.yml (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Nov 20, 2023
1 parent a551bd4 commit a81c43f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
reviewers:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/sitemaps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ jobs:
import requests
def submit_urls_to_indexnow(host, urls):
indexnow_endpoint = "https://api.indexnow.org/indexnow" # Static IndexNow API endpoint
key = os.environ['INDEXNOW_KEY']
endpoint = "https://api.indexnow.org/indexnow" # static API endpoint from https://www.indexnow.org/faq
headers = {"Content-Type": "application/json; charset=utf-8"}
payload = {"host": host, "key": os.environ['INDEXNOW_KEY'], "urlList": urls}
payload = {"host": host, "key": key, "urlList": urls, "keyLocation": f"https://{host}/{key}.txt"}
try:
response = requests.post(indexnow_endpoint, headers=headers, data=json.dumps(payload))
response = requests.post(endpoint, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
print("Submitted batch of URLs to IndexNow ✅")
print(f"Submitted batch of {len(urls)} {host} URLs to IndexNow endpoint {endpoint} ✅")
else:
print(f"Failed to submit batch of URLs: Status code {response.status_code}, Response: {response.text}")
except Exception as e:
Expand Down

0 comments on commit a81c43f

Please sign in to comment.