simple Python module to create XML sitemaps
Project description
############
THIS IS A FORK....
Notes:
# Apesmit was originally written by Florian Diesch at https://www.florian-diesch.de/software/apesmit/
# It was then forked to remove the Python3-only flag since it works with Python 2, ie https://pypi.org/project/apesmit-py2/
# I then had to fork to change the PyPi link to https, due to https://mail.python.org/pipermail/distutils-sig/2017-October/031714.html
############
.. -*- coding: utf-8 -*-
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>
THIS IS A FORK....
Notes:
# Apesmit was originally written by Florian Diesch at https://www.florian-diesch.de/software/apesmit/
# It was then forked to remove the Python3-only flag since it works with Python 2, ie https://pypi.org/project/apesmit-py2/
# I then had to fork to change the PyPi link to https, due to https://mail.python.org/pipermail/distutils-sig/2017-October/031714.html
############
.. -*- coding: utf-8 -*-
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>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apesmit-python2-0.1.tar.gz
(18.4 kB
view hashes)
Built Distribution
Close
Hashes for apesmit_python2-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7abd7932df4519b55a5869dd3febab1ac57b295fa445921b4d132da68abe453e |
|
MD5 | f6ecfcdc24d42b4f44b62994175af96e |
|
BLAKE2b-256 | f714cfd095218ec86c023398288329bd743396cdc45d84a6025a4bb9b5701e6a |