Skip to content

πŸ” Package that makes it easy to submit URLs to the IndexNow API of Bing, Yandex, DuckDuckGo, and other search engines πŸ”Ž

License

Notifications You must be signed in to change notification settings

jakob-bagterp/index-now-for-python

Repository files navigation

Latest version Python 3.11 | 3.12 | 3.13+ MIT license Codecov CodeQL Test Downloads

πŸ” Submit URLs to the IndexNow API of Various Search Enginges πŸ”Ž

Are you concerned about search engine optimization (SEO)? Do you want to make sure your website is indexed frequently by Bing, Yandex, DuckDuckGo, and other search engines?

IndexNow for Python is a lightweight, yet powerful Python package that makes it easy to submit URLs or entire sitemaps to the IndexNow API of various search engines, so your pages can be indexed faster.

Ready to try? Learn how to install and find tutorials in the user guide.

Getting Started

Basic Usage and Submit Individual URLs

Firstly, ensure that you have an API key for IndexNow. Hereafter, add your authentication credentials to the IndexNowAuthentication class, which will be used throughout the examples. You can now submit individual URLs to the IndexNow API:

from index_now import submit_url_to_index_now, IndexNowAuthentication

authentication = IndexNowAuthentication(
    host="example.com",
    api_key="a1b2c3d4",
    api_key_location="https://example.com/a1b2c3d4.txt",
)

submit_url_to_index_now(authentication, "https://example.com/page1")

Important

Instances of authentication = IndexNowAuthentication(...) below refer to this section:

authentication = IndexNowAuthentication(
    host="example.com",
    api_key="a1b2c3d4",
    api_key_location="https://example.com/a1b2c3d4.txt",
)

Submit Multiple URLs in Bulk

How to submit multiple URLs in bulk to the IndexNow API:

from index_now import submit_urls_to_index_now, IndexNowAuthentication

authentication = IndexNowAuthentication(...)

urls = ["https://example.com/page1", "https://example.com/page2", "https://example.com/page3"]

submit_urls_to_index_now(authentication, urls)

Submit Entire Sitemap

How to submit an entire sitemap to the IndexNow API:

from index_now import submit_sitemap_to_index_now, IndexNowAuthentication

authentication = IndexNowAuthentication(...)

sitemap_location = "https://example.com/sitemap.xml"

submit_sitemap_to_index_now(authentication, sitemap_location)

Submit to Specific Search Engines

How to use the default SearchEngineEndpoint options or a custom endpoint:

from index_now import submit_url_to_index_now, IndexNowAuthentication, SearchEngineEndpoint

authentication = IndexNowAuthentication(...)

endpoint_bing = SearchEngineEndpoint.BING
endpoint_custom = "https://example.com/indexnow"

for endpoint in [endpoint_bing, endpoint_custom]:
    submit_url_to_index_now(authentication, "https://example.com/page1", endpoint)

Become a Sponsor πŸ…

If you find this project helpful, please consider supporting its development. Your donations will help keep it alive and growing. Every contribution, no matter the size, makes a difference.

Donate on GitHub Sponsors

Thank you for your support! πŸ™Œ

Contribute

If you have suggestions or changes to the module, feel free to add to the code and create a pull request.

Report Bugs

If you encounter any issues, you can report them as bugs or raise issues.

About

πŸ” Package that makes it easy to submit URLs to the IndexNow API of Bing, Yandex, DuckDuckGo, and other search engines πŸ”Ž

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages