Skip to main content

Posts

Showing posts with the label python

From Python to AppScript

In previous posts , I've been exploring what you can do with Google Apps, the APIs and AppScript. The joy of the APIs is that I can talk to them with my favourite ( textual ) programming language python which in real terms normally means noodling around in the interpreter - eventually saving a page worth of code into a script. I'm comfortable with python, but if I'm to share what I'm doing as a "you can too" thing then I need to knuckle down, give in, and finally learn the basics of Javascript, or rather AppScript. I've always resisted Javascript, because: I really hate braces I loathe semi-colons The string handling seems goofy.toString() itOftenUsesThisTypeOfNotation( ) There's never an interpreter lying around when you need one And the forloops are hideous!  Something that is so naturally fluid in python, seems like line noise to someone like me. It seems crazy that forloops, something you do all the time, are so verbose... I mean.....

Scraping The Festival of Ideas, June 2012

I noticed something on Twitter about the University's Festival of Ideas and thought I'd take a look at the events listing . Not long ago, the Web Office used to put microformat information in web pages so that I could easily add events to my calendar... Either they've stopped doing that, or it's stopped working, so I thought how easy would it be to grab the events listed and add them to my (or a separate calendar). In order to do this, I'd need to... Scrape the HTML from the web page and find the event data Connect to Google Calendar and add the events found Because I like programming in python, the first thing I did was to go get the latest copy of  BeautifulSoup , which is a library that is unbelievably handy for scraping data out of HTML and also Google GData  which lets me talk to Google Calendar. I so I began... import urllib, urlparse, gdata, time, datetime from bs4 import BeautifulSoup import atom import gdata.calendar import gdata.calen...