Skip to content

Instantly share code, notes, and snippets.

@endreszabo
Created November 21, 2013 18:12
Show Gist options
  • Save endreszabo/7586641 to your computer and use it in GitHub Desktop.
Save endreszabo/7586641 to your computer and use it in GitHub Desktop.
koponyeg.hu RSS feedparser hinting
import feedparser
def start_koponyeg_elorejelzes(self, attrsD):
context = self._getContext()
context['koponyeg_elorejelzes_%s' % attrsD['nap']] = attrsD
feedparser._FeedParserMixin._start_koponyeg_elorejelzes = start_koponyeg_elorejelzes
feed = feedparser.parse('http://koponyeg.hu/idojaras_rss.php?regios=1')
@endreszabo
Copy link
Author

Usage:

In [1]: %load koponyeg_rss.py

In [2]: ...

In [3]: feed['entries'][0].keys()
Out[3]: 
['summary_detail',
 u'koponyeg_elorejelzes_holnap',
 'published_parsed',
 'title',
 u'koponyeg_jelenido',
 'summary',
 'guidislink',
 'title_detail',
 'published',
 u'koponyeg_elorejelzes_ma',
 'id']

In [4]: feed['entries'][0]['koponyeg_elorejelzes_ma']                  
Out[4]: 
{'csapadek': u'1',
 'datum': u'2013-11-21',
 'idokep': u'szit\xe1l\xe1s, gyenge es\u0151',
 'idokod': u'14',
 'ikon': u'http://koponyeg.hu/images/egkep/szitalas-42.png',
 'max': u'10',
 'min': u'3',
 'nap': u'ma'}

In [5]: feed['entries'][0]['koponyeg_elorejelzes_holnap']              
Out[5]: 
{'csapadek': u'0',
 'datum': u'2013-11-22',
 'idokep': u'er\u0151sen felh\u0151s',
 'idokod': u'2',
 'ikon': u'http://koponyeg.hu/images/egkep/erosenfelhos-42.png',
 'max': u'10',
 'min': u'5',
 'nap': u'holnap'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment