Skip to main content

Tail your rss and atom feeds

Project description

A Happy Tail

A wagging a tail normally means something is happy, so why not make a cool rss feed reader that
works just like tail.

You can call tail on two types of things, names and urls. Names are setup in the
.wag/feeds file. The config file must have the following layout:

Config File layout:

name url template

name - the name you want to call from the command line

url - the rss/atom feed url

template - the file name for the jinja2 template you want have rendered by default(you can override this will --template if you want).
Also must be in your template_path (currently ~/.wag/templates and '.')

If you need to figure out the keys to generate that template just run `wag <url|name> -k` and
it will spit out the keys and example data assocaited with them.

Setting up your config and templates

Ok, so I have realized that setting up your configs and templates may be a bit
confusing if you have never used any python templating engines. We use the
jinja2 templating engine in ours. So for those who want to get really creative
with their templating you can read the jinja docs at

### Setting up that github rss feed ###

First create the directory ~/.wag and open the file ~/.wag/feed. Put the
following into ~/.wag/feed:

github <your github personalized atom feed> github-template

WTF?? `github` is the name you can call from wag when you want to run it.
This makes it nice so you don't always have to put in the feed when you
want to tail it. `github-template` is the template that it will be looking for.
It will look for this template in your current directory and ~/.wag/templates/

Ok so to setup up that wonderful template you need access to a certain keys.
To get the keys run `wag github --keys` this will give print out the keys and
a sample of what is each key. The format is `<key>: <example>`. Your keys
should look something like this

updated: 2010-03-01T11:49:20-08:00
published_parsed: time.struct_time(tm_year=2010, tm_mon=3, tm_mday=1, tm_hour=19, tm_min=49, tm_sec=20,
tm_wday=0, tm_yday=60, tm_isdst=0)
subtitle: <div class="details">

<div class="message">

friendly's description:
NoSQL with MySQL in Ruby

updated_parsed: time.struct_time(tm_year=2010, tm_mon=3, tm_mday=1, tm_hour=19, tm_min=49, tm_sec=20, tm
_wday=0, tm_yday=60, tm_isdst=0)
links: [{'href': u'', 'type': u'text/html', 'rel': u'alternate'}]
title: rkh started watching jamesgolick/friendly
author: rkh
content: [{'base': '', 'type
': 'text/html', 'value': u'<div class="details">\n \n <div class="message">\n \n friendly\'s d
escription:\n <blockquote>\n NoSQL with MySQL in Ruby\n </blockquote>\n \n </div>\n
</div>', 'language': u'en-US'}]
title_detail: {'base': '', '
type': 'text/plain', 'value': u'rkh started watching jamesgolick/friendly', 'language': u'en-US'}
published: 2010-03-01T11:49:20-08:00
author_detail: {'name': u'rkh'}

Nads, that is a lot of data to process. For now just look at the first part
of each line( the words before the colons ). You have title, links and many
other keys. We are just going to use title and links for this short intro.

So now that we have the keys lets use them. Put the following lines into

{{ title }} - {{ links[0].href }}

My friend Jeff, might think that `{{ title }}` make sense since the keys are
are the part of a hash, or dictionary in python. Now Jeff would definatly
question the `{{ links[0].href }}`. Well links is a hash to an array with
another hash table in it. So we grab the first item in the array and then use
a key from the hash. So the output of the template would be:

rkh started watching jamesgolick/friendly -

Tada now you have a basic template that will be called on all entries of your
github atom feed.

For other help please run `wag -h`

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wag-0.1.1.tar.gz (5.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page