Python Bot + Bing IndexNow API = Microsoft Search Engine Success!

Bing IndexNow use case.

If you are a webmaster, URL submission to search engines is important part of your everyday activities. The script below submits all URLs of your site in one shot to Microsoft BING using IndexNow.

Microsoft Bing IndexNow bot with Python.
Microsoft Bing IndexNow bot meme.

Coding: The Silent Symphony. - Updated: 2024-06-14 by Andrey BRATUS, Senior Data Analyst.

Normally from web interface, Webmasters tools, BINGs limits pages submission to 100 or 10 a day, so Python solution below is nice to have use case.

How does it works in simple words:

- Libraries import.
- Reading actual sitemap and creating dataframe with all URLs.
- Assigning your key and key file path (get them from IndexNow, it's easy).
- Converting DF to list.
- Magic: using FOR loop sending your URLs to BING.

import advertools as adv
import pandas as pd
import requests
import json
import time

sitemap_urls = adv.sitemap_to_df("")

# use your own key, key below was corrected
key = "s4dc7fc3ca124fea8b8a0f7e5982f56a"
url = sitemap_urls["loc"].to_list()
location = ""

for i in url:
          endpoint = f"{i}&key={key}&keyLocation={location}"
          reaction = requests.get(endpoint)

If everything was OK, enjoy 200 response from BING.

Hint #1: switch off VPN before script execution, you might get proxy error.
Hint #2: avoid URL spamming, do not run script too often, might cause website ranking problems.

IndexNow Microsoft Bing bot output

See also related topics: