Add code example

This commit is contained in:
Simeon Warner 2013-01-21 13:53:24 -05:00
parent 367fe39c82
commit 741914afe0
2 changed files with 21 additions and 2 deletions

View File

@ -10,10 +10,20 @@ Typical client usage:
Typical library usage in a source:
```python
from resync.resourcelist import ResourceList
from resync.resource import Resource
from resync.sitemap import Sitemap
rl = ResourceList()
rl.add( Resource('http://example.com/res1', lastmod='2013-01-01') )
rl.add( Resource('http://example.com/res2', lastmod='2013-01-02') )
sm = Sitemap(pretty_xml=True)
print sm.resources_as_xml(rl)
```
See also:
See also
--------
http://github.com/resync/simulator

View File

@ -0,0 +1,9 @@
from resync.resourcelist import ResourceList
from resync.resource import Resource
from resync.sitemap import Sitemap
rl = ResourceList()
rl.add( Resource('http://example.com/res1', lastmod='2013-01-01') )
rl.add( Resource('http://example.com/res2', lastmod='2013-01-02') )
sm = Sitemap(pretty_xml=True)
print sm.resources_as_xml(rl)