Add code example
This commit is contained in:
parent
367fe39c82
commit
741914afe0
14
README.txt
14
README.txt
@ -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
|
||||
|
||||
|
||||
9
docs/examples/01_make_resourcelist.py
Normal file
9
docs/examples/01_make_resourcelist.py
Normal 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)
|
||||
Loading…
Reference in New Issue
Block a user