<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Mahadeva &#187; python</title>
	<atom:link href="http://www.patriciomolina.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.patriciomolina.com</link>
	<description>Blog de Patricio Molina</description>
	<lastBuildDate>Mon, 06 Feb 2012 04:26:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/ar/</creativeCommons:license>		<item>
		<title>Django server en iPod/iPhone</title>
		<link>http://www.patriciomolina.com/2010/05/django-server-en-ipodiphone/</link>
		<comments>http://www.patriciomolina.com/2010/05/django-server-en-ipodiphone/#comments</comments>
		<pubDate>Mon, 17 May 2010 01:58:27 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[jailbreak]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=423</guid>
		<description><![CDATA[Requisitos: Tener &#8220;jailbreakeado&#8221; el iPod/iPhone Instalar OpenSSH, Python y wget usando Cydia Pasos: Accedemos por SSH a nuestro iPod/iPhone usando la red WiFi (ejemplo: $ ssh root@192.168.1.102) $ cd /User/Documents/ $ wget http://www.djangoproject.com/download/1.1.1/tarball/ $ tar xzfv Django-1.1.1.tar.gz $ cd Django-1.1.1 &#8230; <a href="http://www.patriciomolina.com/2010/05/django-server-en-ipodiphone/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Requisitos:</p>
<ul>
<li>Tener &#8220;jailbreakeado&#8221; el iPod/iPhone</li>
<li>Instalar OpenSSH, Python y wget usando <a href="http://cydia.saurik.com/">Cydia</a></li>
</ul>
<p>Pasos:</p>
<ul>
<li>Accedemos por SSH a nuestro iPod/iPhone usando la red WiFi (ejemplo: <tt>$ ssh root@192.168.1.102)</tt></li>
<li><tt>$ cd /User/Documents/</tt></li>
<li><tt>$ wget http://www.djangoproject.com/download/1.1.1/tarball/</tt></li>
<li><tt>$ tar xzfv Django-1.1.1.tar.gz</tt></li>
<li><tt>$ cd Django-1.1.1</tt></li>
<li><tt>$ python setup.py install</tt></li>
</ul>
<p>Ahora creamos un proyecto en /User/Documents/ para probar:</p>
<ul>
<li><tt>$ cd /User/Documents/</tt></li>
<li><tt>$ django-admin.py startproject miproyecto</tt></li>
<li><tt>$ python miproyecto/manage.py runserver</tt></li>
</ul>
<p>¡Listo! Ya tienen un servidor de desarrollo que pueden llevar en el bolsillo</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-424" title="ipod-django" src="http://www.patriciomolina.com/wp-content/uploads/2010/05/ipod-django.png" alt="" width="432" height="288" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2010/05/django-server-en-ipodiphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Identificando posibles &#8220;drops&#8221; de usuarios de Twitter, con Python</title>
		<link>http://www.patriciomolina.com/2010/01/identificando-posibles-drops-de-usuarios-de-twitter-con-python/</link>
		<comments>http://www.patriciomolina.com/2010/01/identificando-posibles-drops-de-usuarios-de-twitter-con-python/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 19:59:01 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=294</guid>
		<description><![CDATA[Hace un par de días se supo que Twitter liberará aquellos nombres de usuario que no hayan registrado actividad durante 6 meses o más. Les dejo una herramienta para obtener los días de inactividad de un usuario a través de &#8230; <a href="http://www.patriciomolina.com/2010/01/identificando-posibles-drops-de-usuarios-de-twitter-con-python/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hace un par de días <a href="http://thenextweb.com/socialmedia/2010/01/19/twitter-username-goldrush/">se supo</a> que <a href="http://twitter.com/">Twitter</a> liberará aquellos nombres de usuario que no hayan registrado actividad durante 6 meses o más.</p>
<p>Les dejo una herramienta para obtener los días de inactividad de un usuario a través de su último <em>status</em> publicado. Esta <a href="http://es.wikipedia.org/wiki/Clase_(inform%C3%A1tica)">clase</a> puede ser utilizada, por ejemplo, para recorrer <a href="http://wordlist.sourceforge.net/">listados de palabras</a> en búsqueda de nombres valiosos.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> twitter
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib2</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">datetime</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> UnknownUser<span style="color: black;">&#40;</span><span style="color: #008000;">Exception</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> UnknownStatus<span style="color: black;">&#40;</span><span style="color: #008000;">Exception</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> TwitterExpire<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.__t = twitter.<span style="color: black;">Api</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> verify<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, username<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #dc143c;">user</span> = <span style="color: #008000;">self</span>.__t.<span style="color: black;">GetUser</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">user</span>=username<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">HTTPError</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span> UnknownUser
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            status = <span style="color: #dc143c;">user</span>.<span style="color: black;">GetStatus</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> status:
                timestamp = status.<span style="color: black;">GetCreatedAtInSeconds</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
                d = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">fromtimestamp</span><span style="color: black;">&#40;</span>timestamp<span style="color: black;">&#41;</span>
                td = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - d
                <span style="color: #ff7700;font-weight:bold;">return</span> td
            <span style="color: #ff7700;font-weight:bold;">else</span>:
                <span style="color: #ff7700;font-weight:bold;">raise</span> UnknownStatus
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span>username<span style="color: black;">&#41;</span>:
    te = TwitterExpire<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
        result = te.<span style="color: black;">verify</span><span style="color: black;">&#40;</span>username<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> UnknownUser:
        <span style="color: #ff7700;font-weight:bold;">print</span> u<span style="color: #483d8b;">&quot;User '%s' doesn't exist&quot;</span> <span style="color: #66cc66;">%</span> username
    <span style="color: #ff7700;font-weight:bold;">except</span> UnknownStatus:
        <span style="color: #ff7700;font-weight:bold;">print</span> u<span style="color: #483d8b;">&quot;Couldn't find any status for '%s'&quot;</span> <span style="color: #66cc66;">%</span> username
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> result
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span>= <span style="color: #ff4500;">2</span>:
        main<span style="color: black;">&#40;</span>username=<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Algunos resultados:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mahadeva@blue:~$ python2.5 last_status.py patito
258 days, 11:16:49.425212
mahadeva@blue:~$ python2.5 last_status.py patricio
Couldn't find any status for 'patricio'
mahadeva@blue:~$ python2.5 last_status.py usuarioinexistente
User 'usuarioinexistente' doesn't exist
mahadeva@blue:~$ python2.5 last_status.py shitmydadsays
1 day, 22:35:44.434214</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2010/01/identificando-posibles-drops-de-usuarios-de-twitter-con-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python 2.5 en iPod Touch 2G</title>
		<link>http://www.patriciomolina.com/2009/12/python-2-5-en-ipod-touch-2g/</link>
		<comments>http://www.patriciomolina.com/2009/12/python-2-5-en-ipod-touch-2g/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 04:37:46 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=273</guid>
		<description><![CDATA[Calculando un timedelta con Python 2.5.1 en el iPod Touch ¡Muy groso!]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="alignnone" title="Python en el iPod Touch" src="http://img710.imageshack.us/img710/5017/pythonipod.png" alt="" width="320" height="480" /></p>
<p style="text-align: center;">Calculando un <a href="http://www.patriciomolina.com/2009/09/python-practico-usando-timedelta-para-calcular-dias-restantes/">timedelta</a> con Python 2.5.1 en el iPod Touch ¡Muy groso!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/12/python-2-5-en-ipod-touch-2g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Me encanta recibir &#8220;buenas noticias&#8221; (con Python)</title>
		<link>http://www.patriciomolina.com/2009/11/me-encanta-recibir-buenas-noticias-con-python/</link>
		<comments>http://www.patriciomolina.com/2009/11/me-encanta-recibir-buenas-noticias-con-python/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 20:39:34 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[buenas noticias]]></category>
		<category><![CDATA[caos]]></category>
		<category><![CDATA[clarin]]></category>
		<category><![CDATA[infobae]]></category>
		<category><![CDATA[inseguridad]]></category>
		<category><![CDATA[la nación]]></category>
		<category><![CDATA[muertos]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=226</guid>
		<description><![CDATA[Acá les dejo un pequeño programa en Python que busca &#8220;buenas noticias&#8221; en los feeds RSS de Clarín, InfoBAE y La Nación. Es altamente configurable (pueden agregar o quitar palabras clave y feeds editando FEEDS y KEYWORDS). 1 2 3 &#8230; <a href="http://www.patriciomolina.com/2009/11/me-encanta-recibir-buenas-noticias-con-python/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Acá les dejo un pequeño programa en Python que busca &#8220;buenas noticias&#8221; en los <em>feeds</em> RSS de <a href="http://www.clarin.com/diario/hoy/um/sumariorss.xml">Clarín</a>, <a href="http://www.infobae.com/adjuntos/html/RSS/hoy.xml">InfoBAE</a> y <a href="http://www.lanacion.com.ar/herramientas/rss/index.asp">La Nación</a>.</p>
<p>Es altamente configurable (pueden agregar o quitar palabras clave y <em>feeds</em> editando <tt>FEEDS</tt> y <tt>KEYWORDS</tt>).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> feedparser
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
&nbsp;
FEEDS = <span style="color: black;">&#123;</span>
    u<span style="color: #483d8b;">'Clarín'</span>: <span style="color: #483d8b;">'http://www.clarin.com/diario/hoy/um/sumariorss.xml'</span>,
    u<span style="color: #483d8b;">'InfoBAE'</span>: <span style="color: #483d8b;">'http://www.infobae.com/adjuntos/html/RSS/hoy.xml'</span>,
    u<span style="color: #483d8b;">'La Nación'</span>: <span style="color: #483d8b;">'http://www.lanacion.com.ar/herramientas/rss/index.asp'</span>,
<span style="color: black;">&#125;</span>
&nbsp;
KEYWORDS = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'muerto'</span>, <span style="color: #483d8b;">'caos'</span>, <span style="color: #483d8b;">'inseguridad'</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    regexps = <span style="color: black;">&#91;</span><span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">keyword</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">IGNORECASE</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #dc143c;">keyword</span> <span style="color: #ff7700;font-weight:bold;">in</span> KEYWORDS<span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> feed_name, feed_source <span style="color: #ff7700;font-weight:bold;">in</span> FEEDS.<span style="color: black;">iteritems</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> entry <span style="color: #ff7700;font-weight:bold;">in</span> feedparser.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>feed_source<span style="color: black;">&#41;</span>.<span style="color: black;">entries</span>:
            <span style="color: #ff7700;font-weight:bold;">for</span> r <span style="color: #ff7700;font-weight:bold;">in</span> regexps:
                <span style="color: #ff7700;font-weight:bold;">if</span> r.<span style="color: black;">search</span><span style="color: black;">&#40;</span>entry.<span style="color: black;">title</span><span style="color: black;">&#41;</span>:
                    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'%s: %s - %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>feed_name, entry.<span style="color: black;">title</span>, entry.<span style="color: black;">link</span><span style="color: black;">&#41;</span>
                    <span style="color: #ff7700;font-weight:bold;">break</span> 
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Acá tienen unos resultados de ejemplo:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">mahadeva@blue:~$ python buenasnoticias.py
InfoBAE: Un muerto y miles de evacuados por una explosión en Rusia - http://www.infobae.com/mundo/484082-101275-0-Un-muerto-y-miles-de-evacuados-por-una-explosión-en-Rusia
La Nación: Varios muertos en Rusia tras una explosión en un arsenal militar - http://www.lanacion.com.ar/nota.asp?nota_id=1199099
Clarín: Inseguridad: en medio de los cruces, el oficialismo se despega de D'Elía - http://www.clarin.com/diario/2009/11/13/um/m-02040147.htm
Clarín: 12:35 - Detienen a tres chicos por el caso del empresario muerto por una pedrada - http://www.clarin.com/diario/2009/11/13/um/m-02040124.htm
Clarín: Otro choque en la General Paz provocó un caos en el tránsito - http://www.clarin.com/diario/2009/11/13/um/m-02040083.htm
Clarín: Detienen a tres chicos por el caso del empresario muerto por una pedrada - http://www.clarin.com/diario/2009/11/13/um/m-02040124.htm</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/11/me-encanta-recibir-buenas-noticias-con-python/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Consultando Crunchbase con Python</title>
		<link>http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/</link>
		<comments>http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 21:52:33 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[crunchbase]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[simplejson]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=91</guid>
		<description><![CDATA[Por mi trabajo, siempre estoy pendiente de lo que sucede en Crunchbase (de hecho, estoy suscripto a su feed de páginas recientes). Con tantas empresas y personas yendo y viniendo por Twitter, se transformó en una fuente de consulta permanente. &#8230; <a href="http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Por mi trabajo, siempre estoy pendiente de lo que sucede en <a href="http://www.crunchbase.com/">Crunchbase</a> (de hecho, estoy suscripto a su <em><a href="http://es.wikipedia.org/wiki/Fuente_web">feed</a></em> de <a href="http://crunchbase.com/recently-added.rss">páginas recientes</a>). Con tantas empresas y personas yendo y viniendo por Twitter, se transformó en una fuente de consulta permanente.</p>
<p>¿Puedo consultar Crunchbase con Python? La respuesta es obvia <img src='http://www.patriciomolina.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Crunchbase tiene una <a href="http://es.wikipedia.org/wiki/Interfaz_de_programaci%C3%B3n_de_aplicaciones">API</a> muy interesante que devuelve resultados en formato <a href="http://es.wikipedia.org/wiki/JSON">JSON</a>. Pueden encontrar documentación sobre su uso en <a href="http://groups.google.com/group/crunchbase-api/">crunchbase-api</a>.</p>
<p>Para este programa estoy usando la librería <a href="http://pypi.python.org/pypi/simplejson/">simplejson</a> (<tt>sudo apt-get install python-simplejson</tt>)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">urllib</span>, simplejson
&nbsp;
api = <span style="color: #483d8b;">'http://api.crunchbase.com/v/1/search.js?%s'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">2</span>:
        q = <span style="color: #483d8b;">' '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        source = <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>api <span style="color: #66cc66;">%</span> <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlencode</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">'query'</span>: q<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        results = simplejson.<span style="color: black;">loads</span><span style="color: black;">&#40;</span>source.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> results<span style="color: black;">&#91;</span><span style="color: #483d8b;">'results'</span><span style="color: black;">&#93;</span>:
            <span style="color: #ff7700;font-weight:bold;">for</span> r <span style="color: #ff7700;font-weight:bold;">in</span> results<span style="color: black;">&#91;</span><span style="color: #483d8b;">'results'</span><span style="color: black;">&#93;</span>:
                name = r.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> name:
                    name = <span style="color: #483d8b;">' '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>w.<span style="color: black;">capitalize</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> \
                        <span style="color: #ff7700;font-weight:bold;">for</span> w <span style="color: #ff7700;font-weight:bold;">in</span> r<span style="color: black;">&#91;</span><span style="color: #483d8b;">'permalink'</span><span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'%s (%s): %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>
                    name.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,
                    r<span style="color: black;">&#91;</span><span style="color: #483d8b;">'namespace'</span><span style="color: black;">&#93;</span>.<span style="color: black;">capitalize</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,
                    r<span style="color: black;">&#91;</span><span style="color: #483d8b;">'crunchbase_url'</span><span style="color: black;">&#93;</span>,
                <span style="color: black;">&#41;</span>       
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'No results for &quot;%s&quot;'</span> <span style="color: #66cc66;">%</span> q
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Usage: python %s &lt;keyword(s)&gt;'</span> <span style="color: #66cc66;">%</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Aquí tienen algunos resultados:</p>
<pre>mahadeva@blue:~$ python crunchbase.py
Usage: python crunchbase.py
mahadeva@blue:~$ python crunchbase.py popego
Popego (Company): http://www.crunchbase.com/company/popego
Santiago Siri (Person): http://www.crunchbase.com/person/santiago-siri
</pre>
<p>El programa en sí no es muy cómodo de usar (para eso existen los <em>add-ons</em> de de Firefox <img src='http://www.patriciomolina.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ), pero es un buen punto de partida para utilizar, por ejemplo, como una <a href="http://www.djangoproject.com/">aplicación de Django</a>, o un <em>bot</em> que interactúe con <a href="http://www.twitter.com/">Twitter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/09/consultando-crunchbase-con-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Buscador para Twitter, con Python, en 12 líneas</title>
		<link>http://www.patriciomolina.com/2009/09/buscador-para-twitter-con-python-en-12-lineas/</link>
		<comments>http://www.patriciomolina.com/2009/09/buscador-para-twitter-con-python-en-12-lineas/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 02:16:13 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[#pyconar2009]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitter search]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=58</guid>
		<description><![CDATA[Hoy estuve viendo los resultados de la búsqueda #pyconar2009 en Twitter Search, y me dije: &#8220;por qué no hacer las búsquedas desde consola, con Python?&#8221; Unos minutos después, aquí está el resultado: 1 2 3 4 5 6 7 8 &#8230; <a href="http://www.patriciomolina.com/2009/09/buscador-para-twitter-con-python-en-12-lineas/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hoy estuve viendo los resultados de la búsqueda <a href="http://search.twitter.com/search?q=%23pyconar2009">#pyconar2009</a> en <a href="http://search.twitter.com/">Twitter Search</a>, y me dije: &#8220;por qué no hacer las búsquedas desde consola, con Python?&#8221;</p>
<p>Unos minutos después, aquí está el resultado:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> feedparser, <span style="color: #dc143c;">urllib</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    feed_source = <span style="color: #483d8b;">'http://search.twitter.com/search.atom?%s'</span>
    q = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Search term: '</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> q:
        f = feedparser.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>feed_source <span style="color: #66cc66;">%</span> <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlencode</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">'q'</span>: q<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> entry <span style="color: #ff7700;font-weight:bold;">in</span> f.<span style="color: black;">entries</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'%s: &quot;%s&quot;'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>entry.<span style="color: black;">author</span>, entry.<span style="color: black;">title</span><span style="color: black;">&#41;</span> 
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>En este caso usé <a href="http://www.feedparser.org/">Universal Feed Parser</a> (<tt>$ sudo apt-get install python-feedparser</tt>), pero pueden utilizar la librería que más les guste <img src='http://www.patriciomolina.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/09/buscador-para-twitter-con-python-en-12-lineas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PyCon Argentina 2009</title>
		<link>http://www.patriciomolina.com/2009/09/pycon-argentina-2009/</link>
		<comments>http://www.patriciomolina.com/2009/09/pycon-argentina-2009/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 03:49:32 +0000</pubDate>
		<dc:creator>Pato</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[argentina]]></category>
		<category><![CDATA[pyar]]></category>
		<category><![CDATA[pycon]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.patriciomolina.com/?p=50</guid>
		<description><![CDATA[El 4 y el 5 asistí a la PyCon Argentina 2009, la primera conferencia mundial en castellano sobre el lenguaje de programación Python. Vi muchas caras conocidas: desde compañeros de laburo hasta amigos del mundo del Software Libre. También vi &#8230; <a href="http://www.patriciomolina.com/2009/09/pycon-argentina-2009/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>El 4 y el 5 asistí a la <a href="http://ar.pycon.org/2009/about/">PyCon Argentina 2009</a>, la primera conferencia mundial en castellano sobre el lenguaje de programación Python. Vi <strong>muchas</strong> caras conocidas: desde compañeros de laburo hasta amigos del mundo del Software Libre. También vi a un par de voluntarios que habían participado de la última <a href="http://wikimania2009.wikimedia.org/wiki/Portal">Wikimanía en Buenos Aires</a>.</p>
<p>Del primer día quiero destacar dos charlas:</p>
<ul>
<li>Me gustó mucho &#8220;<a href="http://ar.pycon.org/2009/conference/schedule/event/13/">Hacking Django, mismo framework, distintos paradigmas</a>&#8221; de <a href="http://ar.pycon.org/2009/profile/19dd/">Nubis</a>. Hizo gala de sus conocimientos y demostró ser un excelente orador. Le veo mucha pasta como conferencista.</li>
<li>&#8220;<a href="http://ar.pycon.org/2009/conference/schedule/event/34/"><em>The State of Django</em></a>&#8221; de <a href="http://jacobian.org/">Jacob Kaplan-Moss</a> me pareció excelente. De todas formas, no estoy totalmente de acuerdo con su punto de vista sobre los problemas de escalabilidad en Django. Si en algún momento se publica un video sobre la charla, me gustaría hacer algunos comentarios.</li>
</ul>
<p>Al final del día me fui a tomar unas cervezas con <a href="http://farm4.static.flickr.com/3469/3891713242_d7a494835e_o.jpg">los pibes de Cycle</a> (hace mil que no los veía), y a la nochecita pintó un paintball por Belgrano.</p>
<p style="text-align: center;"><a href="http://farm3.static.flickr.com/2556/3890922887_93e9b52395.jpg"><img class="aligncenter" title="Yeah!" src="http://farm3.static.flickr.com/2556/3890922887_93e9b52395.jpg" alt="" width="450" height="338" /></a><em>Pintura y metal! (?)</em></p>
<p>Del segundo día también destaco dos charlas:</p>
<ul>
<li>La charla &#8220;<a id="TT20" href="http://ar.pycon.org/2009/conference/schedule/event/16/">Multiprocesamiento en Python</a>&#8221; de <a href="http://ar.pycon.org/2009/profile/1674/">Claudio Freire</a> me encantó. Se explayó con soltura sobre temas como <em>multithreading</em>, <em>multiprocessing</em> y el famoso &#8220;GIL&#8221; de Python. También me gustó que haya hecho una breve introducción a <a href="http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/">Pyrex</a>.</li>
<li>&#8220;<a id="TT46" href="http://ar.pycon.org/2009/conference/schedule/event/35/">Unladen Swallow</a>&#8221; de Collin Winter fue otra excelente charla. Allí se expuso <a href="http://code.google.com/p/unladen-swallow/">cómo Google busca que Python sea 5x más rápido</a>. Si quieren más información al respecto, les recomiendo visitar el <a href="http://code.google.com/p/unladen-swallow/wiki/ProjectPlan">plan del proyecto</a> y prestar especial atencion a &#8220;<em>Places we would like to optimize</em>&#8220;.</li>
</ul>
<p><strong>Mi balance general sobre PyCon Argentina</strong></p>
<p>A favor:</p>
<ul>
<li>El lugar está muy bueno (salas bien iluminadas, limpias y con buena acústica)</li>
<li>En general, la calidad de las charlas programadas fue excelente</li>
<li>Buena onda permanente (me sentí como &#8220;en familia&#8221;)</li>
<li>El equipo organizador y los voluntarios hicieron un <strong>gran</strong> laburo</li>
<li>No se afanaron ninguna laptop <img src='http://www.patriciomolina.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>En contra:</p>
<ul>
<li>No me gustó casi ninguna <a href="http://ar.pycon.org/2009/conference/lightning/">charla relámpago</a> del segundo día<sup>1</sup></li>
<li>Hubiera estado bueno que haya un micrófono entre los asistentes para hacer preguntas sin tener que gritar</li>
</ul>
<p style="text-align: center;"><a href="http://farm3.static.flickr.com/2675/3890920217_b2f90381b5.jpg"><img class="aligncenter" title="Los pitufos de PyCon Argentina 2009" src="http://farm3.static.flickr.com/2675/3890920217_b2f90381b5.jpg" alt="" width="450" height="338" /></a><em>Un aplauso para los &#8220;pitufos&#8221; de PyCon Argentina 2009!</em></p>
<p>Ah, y el año que viene nos vamos todos a Córdoba, para la <strong>PyCon Argentina 2010</strong>!</p>
<p><small>1 &#8211; Salvo excepciones, como la de <a href="http://lateral.netmanagers.com.ar/">Roberto Alsina</a> o la de <a href="http://www.felipelerena.com.ar/">Felipe Lerena</a>.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.patriciomolina.com/2009/09/pycon-argentina-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

