<?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>Chmouel&#039;s Blog &#187; Python</title>
	<atom:link href="http://blog.chmouel.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chmouel.com</link>
	<description>Random and probably boring stuff.</description>
	<lastBuildDate>Wed, 01 Feb 2012 10:28:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Debugging python-novaclient on the command line.</title>
		<link>http://blog.chmouel.com/2011/09/02/debugging-python-novaclient-on-the-command-line/</link>
		<comments>http://blog.chmouel.com/2011/09/02/debugging-python-novaclient-on-the-command-line/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 03:00:13 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Openstack]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=464</guid>
		<description><![CDATA[I have done lately quite a bit of work with python-novaclient the (nova/keystone) openstack client. I often experiment it with ipython in the console. There is a nice debugging facility in novaclient which you can see while using &#8211;debug argument &#8230; <a href="http://blog.chmouel.com/2011/09/02/debugging-python-novaclient-on-the-command-line/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have done lately quite a bit of work with <a href="https://github.com/rackspace/python-novaclient" target="_blank">python-novaclient</a> the (nova/keystone) openstack client. I often experiment it with <a href="http://ipython.org/" target="_blank">ipython</a> in the console.</p>
<p>There is a nice debugging facility in novaclient which you can see while using &#8211;debug argument on the command line and if you wanted to use it with ipython you could have that at the beginning of your session :</p>
<p><script src="https://gist.github.com/1187833.js?file=noclientdebug.py"></script></p>
<p>This would give you the details of the session showing you the REST requests and responses including the headers. It even show you the curl commands that you can use on the command line to experiment with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2011/09/02/debugging-python-novaclient-on-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing python-cloudfiles from pypi</title>
		<link>http://blog.chmouel.com/2011/02/16/installing-python-cloudfiles-from-pypi/</link>
		<comments>http://blog.chmouel.com/2011/02/16/installing-python-cloudfiles-from-pypi/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 05:41:33 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Rackspace]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=399</guid>
		<description><![CDATA[I have just uploaded python-cloudfiles to pypi available here This make things easy to add as a dependence of your project like you can have something like this in your setup.py : requirements = ['python-cloudfiles'] and it will automatically download &#8230; <a href="http://blog.chmouel.com/2011/02/16/installing-python-cloudfiles-from-pypi/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have just uploaded <a href="https://github.com/rackspace/python-cloudfiles">python-cloudfiles</a> to pypi available <a href="http://pypi.python.org/pypi/python-cloudfiles/">here </a></p>
<p>This make things easy to add as a dependence of  your project like  you can have something like this in your setup.py  :</p>
<p><code>requirements = ['python-cloudfiles']</code></p>
<p>and it  will automatically download it as part of the dependence with easy_install or pip. </p>
<p>cool kids on latest debian/ubuntu can do stuff like this (from<a href="http://packages.debian.org/sid/python-stdeb"> python-stdeb</a> package) :</p>
<p><code>pypi-install python-cloudfiles</code></p>
<p>which would automatically download the tarball from pypi and install it as a packages (like the way it should be for prod machine!)</p>
<p>If you have a virtualenv environment you can easily do a (needs <a href="http://packages.debian.org/sid/python-pip">python-pip</a> package) :</p>
<p><code>pip -E /usr/local/myvirtualenvroot install python-cloudfiles<br />
</code></p>
<p>and magic would be done to get you on latest python-cloudfiles.</p>
<p>As a bonus side you can browse online the python-cloudfiles library :</p>
<p><a href="http://packages.python.org/cloudfiles/">http://packages.python.org/python-cloudfiles/</a></p>
<p><strong><br />
[Update] This has been renamed back to python-cloudfiles please update your setup.py or scripts.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2011/02/16/installing-python-cloudfiles-from-pypi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python decorator to argument checking</title>
		<link>http://blog.chmouel.com/2010/07/29/python-decorator-to-argument-checking/</link>
		<comments>http://blog.chmouel.com/2010/07/29/python-decorator-to-argument-checking/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 19:03:57 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=319</guid>
		<description><![CDATA[I am sure there is billions or more people who already done that but I needed this quickly for my project and was not feeling googling around :]]></description>
			<content:encoded><![CDATA[<p>I am sure there is billions or more people who already done that but I needed this quickly for my project and was not feeling googling around :</p>
<p><script src="http://gist.github.com/498939.js?file=ArgumentCheckDecorator.py"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2010/07/29/python-decorator-to-argument-checking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Facebook albums with python</title>
		<link>http://blog.chmouel.com/2010/01/09/get-facebook-albums-with-python/</link>
		<comments>http://blog.chmouel.com/2010/01/09/get-facebook-albums-with-python/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 14:42:19 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=281</guid>
		<description><![CDATA[Since I haven&#8217;t see much script like this around the web here is a quick script to suck bunch of albums from facebooks (your own) nothing fancy just something to get you started with pyfacebook. #!/usr/bin/python import os import urllib &#8230; <a href="http://blog.chmouel.com/2010/01/09/get-facebook-albums-with-python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since I haven&#8217;t see much script like this around the web here is a quick script to suck bunch of albums from facebooks (your own) nothing fancy just something to get you started with pyfacebook.</p>

<div class="wp_codebox"><table><tr id="p2812"><td class="code" id="p281code2"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">from</span> facebook <span style="color: #ff7700;font-weight:bold;">import</span> Facebook
&nbsp;
<span style="color: #808080; font-style: italic;"># see http://developers.facebook.com/get_started.php</span>
<span style="color: #808080; font-style: italic;"># Your API key</span>
API_KEY=<span style="color: #483d8b;">&quot;YOUR_API_KEY&quot;</span>
<span style="color: #808080; font-style: italic;"># Application secret key</span>
SECRET_KEY=<span style="color: #483d8b;">&quot;YOUR_SECRET_KEY&quot;</span>
&nbsp;
cnx = Facebook<span style="color: black;">&#40;</span>API_KEY, SECRET_KEY<span style="color: black;">&#41;</span>
cnx.<span style="color: black;">auth</span>.<span style="color: black;">createToken</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
cnx.<span style="color: black;">login</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
cnx.<span style="color: black;">auth</span>.<span style="color: black;">getSession</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> choose_albums<span style="color: black;">&#40;</span>cnx<span style="color: black;">&#41;</span>:
    cnt = <span style="color: #ff4500;">1</span>
    ret=<span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
    bigthing=cnx.<span style="color: black;">photos</span>.<span style="color: black;">getAlbums</span><span style="color: black;">&#40;</span>cnx.<span style="color: black;">uid</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> bigthing:
        ret<span style="color: black;">&#91;</span>cnt<span style="color: black;">&#93;</span> = row<span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span>, row<span style="color: black;">&#91;</span><span style="color: #483d8b;">'aid'</span><span style="color: black;">&#93;</span>, row<span style="color: black;">&#91;</span><span style="color: #483d8b;">'link'</span><span style="color: black;">&#93;</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;%d) %s - %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>cnt, row<span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span>, row<span style="color: black;">&#91;</span><span style="color: #483d8b;">'link'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        cnt += <span style="color: #ff4500;">1</span>
    ans = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Choose albums (separated by ,): &quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#91;</span>ret<span style="color: black;">&#91;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> ans.<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>
&nbsp;
chosen_albums = choose_albums<span style="color: black;">&#40;</span>cnx<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> album <span style="color: #ff7700;font-weight:bold;">in</span> chosen_albums:
    name, aid, _ =  album
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Album: &quot;</span>, <span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>
    ddir = <span style="color: #483d8b;">&quot;fbgallery/%s&quot;</span> <span style="color: #66cc66;">%</span> name
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>ddir<span style="color: black;">&#41;</span>:
        <span style="color: #dc143c;">os</span>.<span style="color: black;">makedirs</span><span style="color: black;">&#40;</span>ddir<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> photo <span style="color: #ff7700;font-weight:bold;">in</span> cnx.<span style="color: black;">photos</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span>aid=aid<span style="color: black;">&#41;</span>:
        url = photo<span style="color: black;">&#91;</span><span style="color: #483d8b;">'src_big'</span><span style="color: black;">&#93;</span>
        dest=<span style="color: #483d8b;">&quot;%s/%s.jpg&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>ddir, photo<span style="color: black;">&#91;</span><span style="color: #483d8b;">'pid'</span><span style="color: black;">&#93;</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> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>dest<span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Getting: &quot;</span>, url
            <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlretrieve</span><span style="color: black;">&#40;</span>url, dest<span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2010/01/09/get-facebook-albums-with-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Twitter notification of replies by Email</title>
		<link>http://blog.chmouel.com/2010/01/07/twitter-notification-of-replies-by-email/</link>
		<comments>http://blog.chmouel.com/2010/01/07/twitter-notification-of-replies-by-email/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 14:40:25 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=278</guid>
		<description><![CDATA[I don&#8217;t check very often my twitter to know when someone replies and I find it hard to figure out what&#8217;s going on when i check a couple of days after even using a client showing only the reply (my &#8230; <a href="http://blog.chmouel.com/2010/01/07/twitter-notification-of-replies-by-email/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t check very often my twitter to know when someone replies and I find it hard to figure out what&#8217;s going on when i check a couple of days after even using a client showing only the reply (my client of choice lately is the <a href="http://www.emacswiki.org/emacs/TwitteringMode">Emacs twittering</a> mode client)</p>
<p>I have made a script who&#8217;s checking your direct reply and email it to you. This is to setup via a cron on a server who has a mail server configured locally. You can get it from here :</p>
<p><a href="http://github.com/chmouel/twitter-reply-notification">http://github.com/chmouel/twitter-reply-notification</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2010/01/07/twitter-notification-of-replies-by-email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XMPP notification for irssi running in a screen on a remote host</title>
		<link>http://blog.chmouel.com/2009/12/20/xmpp-notification-for-irssi-running-in-a-screen-on-a-remote-host/</link>
		<comments>http://blog.chmouel.com/2009/12/20/xmpp-notification-for-irssi-running-in-a-screen-on-a-remote-host/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 15:41:55 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=261</guid>
		<description><![CDATA[Like a lot of people I have my irssi on a server in a screen. This has been working great so far but my only concerns are the notifications on the desktop when something happening. Over the time I have &#8230; <a href="http://blog.chmouel.com/2009/12/20/xmpp-notification-for-irssi-running-in-a-screen-on-a-remote-host/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Like a lot of people I have my irssi on a server in a screen. This has<br />
been working great so far but my only concerns are the notifications<br />
on the desktop when something happening.</p>
<p>Over the time I have found some different solution with mitigated<br />
results for me :</p>
<p>- Use fanotify script with the libnotify-bin and SSH like mentioned <a href=" http://thorstenl.blogspot.com/2007/01/thls-irssi-notification-script.html">here</a>.</p>
<p>- Setup your irssi (or other) as irc proxy bouncer and connect with<br />
your desktop client (like xchat) to get notification. </p>
<p>The fanotify is kind of very hacky on a laptop with intermittent<br />
connection and having a cron doing a ssh every minutes or so is not<br />
ideal, not talking about no passphrase ssh key or having to snoop the<br />
SSH_AGENT variable to connect without password.</p>
<p>The via proxy method is not my thing and I don&#8217;t feel like having<br />
xchat open all the time just for it and I anyway usually forget to<br />
launch it.</p>
<p>My solution is to have a plugin for irssi notify me via XMPP if there<br />
is a direct message addressed to me. I usually get my pidgin or gmail<br />
alway open and if i don&#8217;t since it goes to a gmail account I got gmail<br />
sending me an email about it.</p>
<p>You can find all the information about the install and configuration<br />
here :</p>
<p><a href="http://github.com/chmouel/irssi-xmpp-notify">http://github.com/chmouel/irssi-xmpp-notify<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/12/20/xmpp-notification-for-irssi-running-in-a-screen-on-a-remote-host/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Accessing to Rackspace Cloud Files via servicenet (update)</title>
		<link>http://blog.chmouel.com/2009/10/20/accessing-to-rackspace-cloud-files-via-servicenet-update/</link>
		<comments>http://blog.chmouel.com/2009/10/20/accessing-to-rackspace-cloud-files-via-servicenet-update/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 18:47:49 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Rackspace]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=236</guid>
		<description><![CDATA[Last week I have posted an article explaining how to connect to Rackspace Cloud Files via Rackspace ServiceNET but I actually got it wrong as pointed by my great colleague exlt so I had to take it down until figured &#8230; <a href="http://blog.chmouel.com/2009/10/20/accessing-to-rackspace-cloud-files-via-servicenet-update/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last week I have posted  an article explaining how to connect to Rackspace Cloud Files via Rackspace ServiceNET but I actually got it wrong as pointed by my great  colleague <a href="http://12.am/">exlt</a> so I had to take it down until figured out how to fix it.</p>
<p>I have add that feature properly to the PHP and Python API in version 1.5.0 to add a &#8216;servicenet&#8217; argument to the connection and updated the blog post here :</p>
<p><a href="http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/">http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/<br />
</a><br />
It should give you all the information for the howto use that feature.</p>
<p>I have released as well a minor update in 1.5.1 to allow you to define the environment variable RACKSPACE_SERVICENET to force the use of the Rackspace ServiceNET this allow you to don&#8217;t have to modify the tools and have a clean code  between prod and testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/10/20/accessing-to-rackspace-cloud-files-via-servicenet-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to connect to Rackspace Cloud Files via ServiceNET</title>
		<link>http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/</link>
		<comments>http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 00:47:27 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Rackspace]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=228</guid>
		<description><![CDATA[If you are a Rackspace customer and you are are planning to use Rackspace Cloud Files via it&#8217;s internal network (ServiceNet) so you don&#8217;t get billed for the bandwidth going over Cloud Files this is how you can do. The first thing is &#8230; <a href="http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="background-color: #ffffff;">If you are a Rackspace customer and you are are planning to use Rackspace Cloud Files via it&#8217;s internal network (ServiceNet) so you don&#8217;t get billed for the bandwidth going over Cloud Files this is how you can do.</span></p>
<p>The first thing is to make sure with your support team if your servers are connected to ServiceNet and if you have that connection then there is a small change to do in your code.</p>
<p>The second thing is to use the just released 1.5.0 version on GitHUB for PHP :</p>
<p><a href="http://github.com/rackspace/php-cloudfiles/tree/1.5.0">http://github.com/rackspace/php-cloudfiles/tree/1.5.0</a></p>
<p>and for python :</p>
<p><a href="http://github.com/rackspace/python-cloudfiles/tree/1.5.0">http://github.com/rackspace/python-cloudfiles/tree/1.5.0</a></p>
<p>(you need to click on the download link at the top to download the tarball of the release).</p>
<p>Afer this is just a matter to set the argument servicenet=True, for example in PHP :</p>

<div class="wp_codebox"><table><tr id="p2285"><td class="code" id="p228code5"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$user</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$api_key</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'theapi_key'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$auth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CF_Authentication<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$api_key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$auth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">authenticate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CF_Connection<span style="color: #009900;">&#40;</span><span style="color: #000088;">$auth</span><span style="color: #339933;">,</span> <span style="color: #000088;">$servicenet</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In Python you can do like this :</p>

<div class="wp_codebox"><table><tr id="p2286"><td class="code" id="p228code6"><pre class="python" style="font-family:monospace;">username=<span style="color: #483d8b;">'username'</span>
api_key=<span style="color: #483d8b;">'api_key'</span>
&nbsp;
cnx = cloudfiles.<span style="color: black;">get_connection</span><span style="color: black;">&#40;</span>username, api_key, servicenet=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>python syntax warning in emacs</title>
		<link>http://blog.chmouel.com/2009/08/31/python-syntax-warning-in-emacs/</link>
		<comments>http://blog.chmouel.com/2009/08/31/python-syntax-warning-in-emacs/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 05:04:28 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.chmouel.com/?p=169</guid>
		<description><![CDATA[One of the best feature to have with Emacs when doing python development is to have a real time syntax error/warning check highlighted in your code to avoid many errors or superfluous code. This code is taken from the brillant &#8230; <a href="http://blog.chmouel.com/2009/08/31/python-syntax-warning-in-emacs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the best feature to have with Emacs when doing python development is to have a real time syntax error/warning check highlighted in your code to avoid many errors or superfluous code.</p>
<p>This code is taken from the brillant Emacswiki <a href="http://www.emacswiki.org/cgi-bin/wiki/PythonMode">python page</a>.</p>
<p>You need to install pyflakes first which should be available on your linux distro by default in a package or for the other OS you may follow the procedure from the <a href="http://www.divmod.org/trac/wiki/DivmodPyflakes">pyflakes webpage</a>.</p>
<p>and add this configuration to your .emacs :</p>

<div class="wp_codebox"><table><tr id="p1698"><td class="code" id="p169code8"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span>load <span style="color: #ff0000;">&quot;flymake&quot;</span> t<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> flymake-pyflakes-init <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>temp-file <span style="color: #66cc66;">&#40;</span>flymake-init-create-temp-buffer-copy
                     'flymake-create-temp-inplace<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span>local-file <span style="color: #66cc66;">&#40;</span>file-relative-<span style="color: #b1b100;">name</span>
                      temp-file
                      <span style="color: #66cc66;">&#40;</span>file-name-directory buffer-file-<span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">list</span> <span style="color: #ff0000;">&quot;pyflakes&quot;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">list</span> local-file<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'flymake-allowed-file-name-masks
             '<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>.py<span style="color: #000099; font-weight: bold;">\\</span>'&quot;</span> flymake-pyflakes-init<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>make sure pyflakes is in your path and enable flymake-mode by default if you like for all python mode :</p>
<p><code><br />
(add-hook 'python-mode-hook 'my-python-mode-hook)</code></p>
<p>go by M-x customize flymake as well if you like to customise some variables.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2009/08/31/python-syntax-warning-in-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yum Force Exclude List</title>
		<link>http://blog.chmouel.com/2008/03/20/yum-force-exclude-list/</link>
		<comments>http://blog.chmouel.com/2008/03/20/yum-force-exclude-list/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 09:36:06 +0000</pubDate>
		<dc:creator>chmouel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.chmouel.com/blog/2008/03/20/yum-force-exclude-list/</guid>
		<description><![CDATA[While talking with my fellow colleague Darren Birkett about what seems a design limitation of yum to not be able to force listing the excludes from yum. I had a shoot to make a yum plugin to force listing the &#8230; <a href="http://blog.chmouel.com/2008/03/20/yum-force-exclude-list/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While talking with my fellow colleague Darren Birkett about what seems a design limitation<br />
of yum to not be able to force listing the excludes from yum. I had a<br />
shoot to make a yum plugin to force listing the excludes.</p>
<p>Here is how it works :</p>
<blockquote><p>root@centos5:~&gt; grep exclude /etc/yum.conf<br />
exclude=rpm*<br />
root@centos5:~&gt; yum install rpm-devel<br />
Loading &#8220;installonlyn&#8221; plugin<br />
Loading &#8220;changelog&#8221; plugin<br />
Loading &#8220;chmouel&#8221; plugin<br />
Loading &#8220;priorities&#8221; plugin<br />
Setting up Install Process<br />
Setting up repositories<br />
Reading repository metadata in from local files<br />
Excluding Packages in global exclude list<br />
Finished<br />
0 packages excluded due to repository priority protections<br />
Parsing package install arguments<br />
Nothing to do</p></blockquote>
<p>rpm* is excluded, but if we use the environment variable <strong>FORCE_EXCLUDE</strong><br />
it will force it.</p>
<blockquote><p> root@centos5:~&gt; FORCE_EXCLUDE=true yum install rpm-devel<br />
Loading &#8220;installonlyn&#8221; plugin<br />
Loading &#8220;changelog&#8221; plugin<br />
Loading &#8220;chmouel&#8221; plugin<br />
Loading &#8220;priorities&#8221; plugin<br />
Setting up Install Process<br />
Setting up repositories<br />
Reading repository metadata in from local files<br />
0 packages excluded due to repository priority protections<br />
Parsing package install arguments<br />
Resolving Dependencies<br />
&#8211;&gt; Populating transaction set with selected packages. Please wait.<br />
&#8212;&gt; Downloading header for rpm-devel to pack into transaction set.<br />
rpm-devel-4.4.2-47.el5.i3 100% |=========================| 17 kB 00:00<br />
&#8212;&gt; Package rpm-devel.i386 0:4.4.2-47.el5 set to be updated<br />
&#8211;&gt; Running transaction check<br />
[.....]</p></blockquote>
<p>It will allow you to list the excluded rpm as well :</p>
<blockquote><p> root@centos5:~&gt; FORCE_EXCLUDE=true yum list|grep rpm<br />
rpm.i386 4.4.2-47.el5 installed<br />
rpm-libs.i386 4.4.2-47.el5 installed<br />
rpm-python.i386 4.4.2-47.el5 installed<br />
redhat-rpm-config.noarch 8.0.45-22.el5.centos base<br />
rpm-build.i386 4.4.2-47.el5 base<br />
rpm-devel.i386 4.4.2-47.el5 base<br />
root@centos5:~&gt; yum list|grep rpm<br />
rpm.i386 4.4.2-47.el5 installed<br />
rpm-libs.i386 4.4.2-47.el5 installed<br />
rpm-python.i386 4.4.2-47.el5 installed<br />
redhat-rpm-config.noarch 8.0.45-22.el5.centos base</p></blockquote>
<p>See the README.txt in the rpm file to see how to use/install it.</p>
<p>You can download the rpm<a href="http://www.chmouel.com/blog/wp-content/uploads/2008/03/yum-forceexclude-02-1noarch.rpm" title="Yum Force Exclude Plugin"> here</a> and the src.rpm <a href="http://www.chmouel.com/blog/wp-content/uploads/2008/03/yum-forceexclude-02-1src.rpm" title="Yum Force Exclude Plugin src.rpm">here</a></p>
<blockquote></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.chmouel.com/2008/03/20/yum-force-exclude-list/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

