mi blag

19 Enero, 11:12pm

Tiempo de lectura estimada: 1 minutos

Víctor Jáquez

pienso en ti con mis manos

I would like to say all I done... but it's very few, don't even remember.

This is a good reading: Getting Back To Work: A Personal Productivity Toolkit.

Last night I was playing with python, my intention was write a web file fetcher, and I rediscovered the reason why I don't like the language: it's documentation. If you read it carefully, your code doesn't work, you need to search for the "issues". So I waste 3 hour of sleep in order to write this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import urllib2, base64

atomurl = 'https://gmail.google.com/gmail/feed/atom/index.xml'

def get_atom(username, password):
    req = urllib2.Request(atomurl)
    auth = base64.encodestring('%s:%s' % (username, password))[:-1]
    req.add_header("Authorization", "Basic %s" % auth)
    fh = urllib2.urlopen(req)
    data = fh.read()
    fh.close()
    return data

def main():
    print get_atom('ceyusa', 'mipass')

if __name__ == '__main__':
    main()

Reading George Orwell's Nineteen Eighty-Four, I found a few known names, like big brother or Emmanuel Goldstein. Great book.