# atomgen
**Repository Path**: mirrors_seperman/atomgen
## Basic Information
- **Project Name**: atomgen
- **Description**: Creates Apple Newsstand Atom Feed
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-25
- **Last Updated**: 2026-02-15
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
##atomgen v 0.1.9
=======
Creates Apple Newsstand Atom Feed that is compatible with v1.2 of Atom Feed
It can also validate remote or local images based on Atomfeed specifications
Note that this is different than normal Atom Feed: [Specification](https://itunesconnect.apple.com/docs/NewsstandAtomFeedSpecification.pdf)
##Installation
Install from PyPi:
pip install atomgen
Atomgen is tested and used in production on Python 2.7
Atomgen is compatible with Python 3.3 but has not been used in production.
##Example usage
>>> import datetime
>>> from atomgen import AtomGen
Simple
>>> a=[{'id':'1','updated':datetime.datetime(2013, 12, 10, 1, 9, 53, 977342),
... 'published':datetime.datetime(2013, 12, 10, 1, 10, 53, 977342),
... 'summary':"This is the summary 1",'icon':"http://ccc.com/img.png"},
... {'id':2,'updated':datetime.datetime(2013, 12, 9, 1, 9, 53, 977342),
... 'published':datetime.datetime(2013, 12, 10, 1, 7, 53, 977342),
... 'summary':"This is the summary 2",'icon':"http://ccc2.com/img2.png"}]
>>> my_atom = AtomGen()
>>> print my_atom.run(a, update_time=datetime.datetime(2013, 12, 10, 1, 9, 53, 977342))
2013-12-10T01:09:53Z12013-12-10T01:09:53Z2013-12-10T01:10:53ZThis is the summary 122013-12-09T01:09:53Z2013-12-10T01:07:53ZThis is the summary 2
Renaming element names in the original dictionary. you need to let AtomGen know the correspondence to the default names.
>>> b=[{'my_id':'1','when_updated':datetime.datetime(2013, 12, 10, 1, 9, 53, 977342),
... 'when_published':datetime.datetime(2013, 12, 10, 1, 10, 53, 977342),
... 'the_summary':"This is the summary 1",'myicon':"http://ccc.com/img.png"},
... {'my_id':2,'when_updated':datetime.datetime(2013, 12, 9, 1, 9, 53, 977342),
... 'when_published':datetime.datetime(2013, 12, 10, 1, 7, 53, 977342),
... 'the_summary':"This is the summary 2",'myicon':"http://ccc2.com/img2.png"}]
>>> my_atom2 = AtomGen(id="my_id",published="when_published",updated="when_updated",
... summary="the_summary",icon="myicon")
>>> print my_atom2.run(b, update_time=datetime.datetime(2013, 12, 10, 1, 9, 53, 977342))
2013-12-10T01:09:53Z12013-12-10T01:09:53Z2013-12-10T01:10:53ZThis is the summary 122013-12-09T01:09:53Z2013-12-10T01:07:53ZThis is the summary 2
Using a dicionary of dictionaries (like a json structure) for input
>>> c={1:{'updated':datetime.datetime(2013, 12, 10, 1, 9, 53, 977342),
... 'published':datetime.datetime(2013, 12, 10, 1, 10, 53, 977342),
... 'summary':"This is the summary 1",'icon':"http://ccc.com/img.png"},
... 2:{'updated':datetime.datetime(2013, 12, 9, 1, 9, 53, 977342),
... 'published':datetime.datetime(2013, 12, 10, 1, 7, 53, 977342),
... 'summary':"This is the summary 2",'icon':"http://ccc2.com/img2.png"},}
>>> print my_atom.run(c, update_time=datetime.datetime(2013, 12, 10, 1, 9, 53, 977342))
2013-12-10T01:09:53Z12013-12-10T01:09:53Z2013-12-10T01:10:53ZThis is the summary 122013-12-09T01:09:53Z2013-12-10T01:07:53ZThis is the summary 2
Using a dicionary of dictionaries for input with custom names
>>> d={'1':{'when_updated':datetime.datetime(2013, 12, 10, 1, 9, 53, 977342),
... 'when_published':datetime.datetime(2013, 12, 10, 1, 10, 53, 977342),
... 'the_summary':"This is the summary 1",'myicon':"http://ccc.com/img.png"},
... 2:{'when_updated':datetime.datetime(2013, 12, 9, 1, 9, 53, 977342),
... 'when_published':datetime.datetime(2013, 12, 10, 1, 7, 53, 977342),
... 'the_summary':"This is the summary 2",'myicon':"http://ccc2.com/img2.png"},}
>>> my_atom2 = AtomGen(id="my_id",published="when_published",updated="when_updated",
... summary="the_summary",icon="myicon")
>>> print my_atom2.run(d, update_time=datetime.datetime(2013, 12, 10, 1, 9, 53, 977342))
2013-12-10T01:09:53Z12013-12-10T01:09:53Z2013-12-10T01:10:53ZThis is the summary 122013-12-09T01:09:53Z2013-12-10T01:07:53ZThis is the summary 2
This will generate exactly the same Atom feed. But it gives you the flexibility of modifying your own dictionary keys with the names you like.
Automatically Validating Images
>>> d={'1':{'when_updated':datetime.datetime(2013, 12, 10, 1, 9, 53, 977342),
... 'when_published':datetime.datetime(2013, 12, 10, 1, 10, 53, 977342),
... 'the_summary':"This is the summary 1",'myicon':"http://cdn.tennis.com/uploads/magazine/test_material/img_1024_600.png"},
... 2:{'when_updated':datetime.datetime(2013, 12, 9, 1, 9, 53, 977342),
... 'when_published':datetime.datetime(2013, 12, 10, 1, 7, 53, 977342),
... 'the_summary':"This is the summary 2",'myicon':"http://cdn.tennis.com/uploads/magazine/test_material/img_1024_600.png"},}
>>> my_atom2 = AtomGen(id="my_id",published="when_published",updated="when_updated",
... summary="the_summary",icon="myicon")
>>> print (my_atom2.run(d, update_time=datetime.datetime(2013, 12, 10, 1, 9, 53, 977342), validate_image=True) )
http://cdn.tennis.com/uploads/magazine/test_material/img_1024_600.png validated
2013-12-10T01:09:53Z12013-12-10T01:09:53Z2013-12-10T01:10:53ZThis is the summary 122013-12-09T01:09:53Z2013-12-10T01:07:53ZThis is the summary 2
##Documents
* [Documentations](http://atomgen.readthedocs.org/en/latest/)
##Author
Erasmose
* [Github](https://github.com/erasmose)
* [Linkedin](http://www.linkedin.com/in/sepehr)