Skip to content

Instantly share code, notes, and snippets.

@reddgr
Last active October 6, 2024 14:44
Show Gist options
  • Save reddgr/0508a15ff540b3601fe6303a586ec879 to your computer and use it in GitHub Desktop.
Save reddgr/0508a15ff540b3601fe6303a586ec879 to your computer and use it in GitHub Desktop.
IndexNow API call example
# %%
import requests
import json
# %%
# About IndexNow: https://www.bing.com/indexnow/getstarted
# IndexNow is an open-source protocol created by Microsoft Bing and Yandex.
# IndexNow allows websites to notify participating search engines about content changes,
# such as updates, additions, or deletions, through a simple API call.
url = 'https://api.indexnow.org/IndexNow'
headers = {
'Content-Type': 'application/json; charset=utf-8',
}
data = {
"host": "talkingtochatbots.com",
"key": "b242e265e1424b95a001530d7e7b1b10",
"keyLocation": "https://talkingtochatbots.com/b242e265e1424b95a001530d7e7b1b10.txt", # get your own: https://www.bing.com/indexnow/getstarted
"urlList": [
"https://talkingtochatbots.com/predicting-chatbot-arena-votes-with-the-scbn-and-rqtl-benchmarks",
"https://talkingtochatbots.com/just-images-talking-to-chatbots-image-gallery",
"https://talkingtochatbots.com/cant-stop-partying-hedonism-love-and-the-enshittification-of-everything-ttcb-xv"
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.status_code)
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment