Skip to content

Instantly share code, notes, and snippets.

@juque
Created May 4, 2011 02:15
Show Gist options
  • Select an option

  • Save juque/954634 to your computer and use it in GitHub Desktop.

Select an option

Save juque/954634 to your computer and use it in GitHub Desktop.
Patan 2.01
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import feedparser, pprint
# Documentacion feedparse:
# http://www.feedparser.org/docs/
feed_mercado_publico = "http://www.mercadopublico.cl/Portal/feed.aspx?OrgCode=296647"
# Depurar
pp = pprint.PrettyPrinter(depth=6)
d = feedparser.parse(feed_mercado_publico)
for i,entrada in enumerate(d['entries']):
if i > 10:
break
print """
contador : %d
título : %s
resumen : %s
enlace : %s
actualizado : %s
""" % (
i,
entrada['title'].encode('utf-8'),
entrada['summary'].encode('utf-8'),
entrada['link'].encode('utf-8'),
entrada['updated'].encode('utf-8')
)
print ("Total de licitaciones parseadas: %s" % len(d['entries']))
# vim: set ts=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment