<?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/"
	>

<channel>
	<title>It's not a blog, It's a feature &#187; google</title>
	<atom:link href="http://javazquez.com/juan/category/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://javazquez.com/juan</link>
	<description>Juan A. Vazquez</description>
	<lastBuildDate>Wed, 16 Nov 2011 02:45:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Fun with Python and Gmail API</title>
		<link>http://javazquez.com/juan/2008/12/24/fun-with-python-and-gmail-api/</link>
		<comments>http://javazquez.com/juan/2008/12/24/fun-with-python-and-gmail-api/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 17:58:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[google api]]></category>

		<guid isPermaLink="false">http://javazquez.com/juan/?p=82</guid>
		<description><![CDATA[Quick demonstration on how to pull contacts from gmail using python]]></description>
			<content:encoded><![CDATA[<p>Yesterday I decided to play with Gmail&#8217;s API in order to grab my contacts. To my surprise, it was a snap. Google has instructions for python <a href="http://code.google.com/apis/gdata/articles/python_client_lib.html">Here</a>, I wrote my example using Python 2.5 on OS X. Once I had unzipped the GData contents, I just changed to the GData directory and ran <br/>&#8220;<strong>sudo python setup.py install</strong>&#8221; <br /> and I was ready to go.</p>
<p><a href="http://gdata-python-client.googlecode.com/svn/trunk/pydocs/">Python Documentation for GDATA</a></p>
<p><code>
<pre>
#################################<br />
# javazquez.com<br />
# Google GMAIL API example<br />
##################################<br />
import gdata.contacts.service</p>
<p>user = 'user@gmail.com'<br />
pwd = 'password'<br />
client2 = gdata.contacts.service.ContactsService()<br />
# Authenticate using your Google Docs email address<br />
# and password.<br />
client2.ClientLogin(user, pwd)<br />
contacts_feed = client2.GetContactsFeed()</p>
<p>################################################<br />
# NOTE: The GetContactsFeed does not give back<br />
#		all contacts.<br />
#              This 'problem' can be solved by looping<br />
#		until the contacts_feed.GetNextLink<br />
#             returns  None.<br />
################################################<br />
l=[]<br />
while(contacts_feed) :<br />
	for x in contacts_feed.entry:<br />
		l.append([x.title.text, x.email[0].address])<br />
	ret = contacts_feed.GetNextLink()<br />
 	contacts_feed = client2.GetContactsFeed(ret.href)  if(ret) else ret</p>
<p>print "here are your %d contacts" % len(l)<br />
for contact in l:<br />
	print "%s -> %s" % (contact[0],contact[1])<br />
</ pre><br />
</code><br />
<strong>Output</strong></p>
<blockquote><p>here are your xxxx contacts<br />
ANDREW  -> adrew@somewhere.com<br />
...
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://javazquez.com/juan/2008/12/24/fun-with-python-and-gmail-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

