Skip to main content


Project description

A Python utility for building sitemaps.


Generate sitemap

import datetime
import sitemap.generator as generator

sitemap = generator.Sitemap()
sitemap_xml = sitemap.generate()

sitemap_index = generator.Sitemap(type='sitemapindex')
sitemap_index_xml = sitemap_index.generate()

Ping search engine

Currently support ping Google and Bing with sitemap urls.

import as ping"google", "")
ping.ping_urls("bing", [""])

Push url to Baidu

Push urls directly to Baidu. Related document available at here.

import as baidu
bp = baidu.BaiduPush("", "<YOUR_KEY>")

Verify the spider ip address

sitemap.spider can be use to verify whether the ip address of spider is genius.


from sitemap.spider import get_verified_spider_name

# spider_name will be None if no search engine is matched
spider_name = get_verified_spider_name("")

The method get_verified_spider_name has uses socket.gethostbyaddr, which may be slow in some cases. So make guess_spider_name_from_ua method may filter out several results via User-Agent.

from sitemap.spider import get_verified_spider_name, guess_spider_name_from_ua

spider_name = guess_spider_name_from_ua(spider_ua)
if spider_name:
    spider_name = get_verified_spider_name(spider_ip)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sitemap_python, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size sitemap_python-0.2.0-py2.py3-none-any.whl (6.7 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size sitemap_python-0.2.0.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page