Skip to main content

THIS IS A FORK

The metadata for the Apesmit package by Florian Diesch indicates Python 3 compatibility, but it actually works fine with Python 2. This fork just removes the Python 3-only flag.

What is ApeSmit?

ApeSmit is a very simple Python module to create XML sitemaps as defined at http://www.sitemaps.org. ApeSmit doesn’t contain any web spider or something like that, it just writes the data you provide to a file using the proper syntax.

Usage

First we create an instance of SiteMap:

>>> sm=Sitemap(changefreq='weekly')

The changefreq keyword sets a default value for that parameter.

Now we add some URL’s to our sitemap:

>>> sm.add('http://www.example.com/')

We may use some parameters:

>>> sm.add('http://www.example.com/news/', changefreq='daily',
...                                        priority=1.0,
...                                        lastmod='1891-1-1')

There’s a shortcut for URL’s that changed today:

>>> sm.add('http://www.example.org/about.html', lastmod='today')

That’s all for now. Next we need a file to write the sitemap in:

>>> out=open('sitemap.xml', 'w')

Now we write our sitemap and then close the file:

>>> sm.write(out)
>>> out.close()

And that’s the content of our shiny new sitemap:

<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 <url>
  <loc>http://www.example.com/</loc>
  <changefreq>weekly</changefreq>
 </url>
 <url>
  <loc>http://www.example.com/news/</loc>
  <lastmod>1891-1-1</lastmod>
  <changefreq>daily</changefreq>
  <priority>1.0</priority>
 </url>
 <url>
  <loc>http://www.example.org/about.html</loc>
  <lastmod>2008-04-03</lastmod>
  <changefreq>weekly</changefreq>
 </url>
</urlset>

Release files for apesmit-py2 0.01

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apesmit-py2 0.01
File Size Uploaded
apesmit-py2-0.01.tar.gz 18.1 kB Details

Release files / apesmit-py2-0.01.tar.gz

Download URL apesmit-py2-0.01.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6cb4ef96825261b8637b69256aac853c1b11ebb9c5ab04d15bb1d036d088eb93
BLAKE2b-256 checksum
How to use checksums
ad69ac08184c29b9ced2aab2074bb1c7015df73dd51347cc67a03067fcb28af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.01 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page