HTTP Basic Authentication with Google App Engine

February 8th, 2009

Today while playing with GAE I tried to get some data from Twitter but I needed to authenticate doing HTTP Basic Authentication. After some research online I found how to do it and it’s very simple. This example shows how to get a list of followers from Twitter in JSON Format.


from google.appengine.api import urlfetch
import base64

url = “http://twitter.com/statuses/followers.json”
authString = ‘Basic ‘ + base64.encodestring(’user:password’)
data = urlfetch.fetch(url, headers={’AUTHORIZATION’ : authString})

LbL:

  1. Import the library for making the request ‘urlfetch
  2. This library is going to encode the user and pass to base64 format, which HTTP Basic Auth uses.
  3. Specify the URI which will respond with JSON data
  4. The authorization string is going to look something like this:
    ‘Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==’
  5. Perform the request adding the header ‘AUTHORIZATION’ with the authentication string.

You can go a step further by importing simplejson and parsing the data, and ending up with a nice python object.

from django.utils import simplejson
followers = simplejson.loads(data.content)

Hope it helps someone!

Please Stop Media Waste!

January 31st, 2009

The people from SSMP bring to us: “Please Stop Creating Online Waste!”

Interesting… haha

Microsoft’s new joke…

January 11th, 2009

Songsmith is a reversed karaoke: the computer plays a tune to match your voice.

I have to admit it’s innovative and entertaining, yet not quite useful.

I think it’s funny.

iTunes on Ubuntu without Wine (Almost)

January 4th, 2009

songbird + ubuntu + itunes theme

I’m not really proud to say what I’m about to say, here it goes: My Favorite Music Player is iTunes.

I tried Amarok, Rythmbox, MPlayer, VLC, and all of them have mostly the same functionality iTunes has; some of them even go funky with some plugins that for example, can search and play songs straight from youtube or myspace. But I still don’t like them, why? Because of the same reasons I didn’t like Windows Media Player when I was used to Winamp: the feel, the look, and the familiarity.

I think this are some of the reasons why the average non-geek person hasn’t switched to some Linux flavor. Windows or Mac are just easier to use and look nice after all.

Linux is pure beauty from a programmer’s point of view, but how does it look to a designer? or to the non programming person? I have to say it’s been improving a lot in the recent years, and with some time you can customize it to make it look or feel the way you want. Although there are projects like mac4lin which make Linux look like a Mac, most people don’t have the time and technical knowledge to set this up.

Alright enough said :) here’s how to get and set Songbird to feel like iTunes.

Install Songbird:

  1. Download Songbird (Right click / Save As), save in /opt
  2. cd /opt
  3. tar xzvf Song… + <TAB> + <ENTER>
  4. cd /Song + <TAB> + <ENTER>
  5. sudo chmod +x songbird
  6. ./songbird

Create an app menu entry:

  1. Right click on Applications Menu
  2. Click on Edit Menus
  3. / Sound and Video
  4. New Item
    1. Command: /opt/Songbird/songbird
    2. Icon: /opt/Songbird/songbird.png

Set the iTunes Theme In Songbird:

  1. Click on View / Feathers / Get More Feathers…
  2. Find iTunes / Click Install
  3. Maybe Restart Songbird
  4. Voila!

More Detailed Instructions Here

‘No Contract G1 + Unlock’ Story

December 19th, 2008
Unlock G1

Unlock G1

For the last year and a half I’ve had the worst cellphone on earth. I originally bought this phone because it had the walkie-talkie feature which I used to talk with my friends back home for *free, and because back then I thought Windows Mobile could be good. I soon realized that the battery wouldn’t last for more than half a day, and that every time it died it would take like 5 minutes to boot up (read Windows Mobile). Apart from the cellphone itself I also disliked Sprint’s customer service. At that time I though I had no choice other than waiting 2 years for my contract to expire, so I learned to deal with it.

Then one day I was sitting at Google I/O and watched a demonstration of the possibilities of the Android Platform. What really caught my eye was a live demonstration of Google Street View using the phone’s internal compass. And suddenly I felt like I had to get that phone, it wasn’t out on the market yet, but I would wait.
Read the rest of this entry »

Why I Like Barack Obama

December 8th, 2008

I don’t know much about US politics, but here’s one reason why I like Obama.

Aggressively Defending Graphs

December 1st, 2008

I just though it was funny…

Aggresively Defending Graphs

Aggresively Defending Graphs

Source:

http://sci.tech-archive.net/Archive/sci.logic/2004-06/1436.html