I tried a couple of "RSS to twitter" services and both worked once and then never again. Google app engine looked like a good way of finding a server to do the stuff to join RSS to twitter. So I cobbled together bits of Python code and came up with this:
(Paste in code from feedparser.org. Comment out the main program stuff.# Cobbled together from# http://highscalability.com/using-google-appengine-little-micro-scalability# http://pydanny.blogspot.com/2008/04/feedparser-does-not-work-with-google.htmlimport wsgiref.handlersfrom datetime import *import urllibfrom google.appengine.api import urlfetchimport base64import feedparserimport StringIOfrom google.appengine.ext import webappdef getWeather():content = urlfetch.fetch("http://feeds.bbc.co.uk/weather/feeds/rss/5day/id/2111.xml").contentd = feedparser.parse(StringIO.StringIO(content))if d.bozo == 1:raise Exception("Can not parse given URL.")return d['entries'][0]['title']class WeatherText(webapp.RequestHandler):def get(self):self.response.headers['Content-Type'] = 'text/html'self.response.out.write(getWeather())self.response.out.write('supported by backstage.bbc.co.uk')
class UpdateWeather(webapp.RequestHandler):def get(self):self.response.headers['Content-Type'] = 'text/plain'login = "wycombeweather"password = "password"message = getWeather()payload= {'status' : message, 'source' : 'wycombeweather'}payload= urllib.urlencode(payload, True)# Get rid of degree marks because they turn out as question marks in the final tweetpayload = payload.replace('%3F','')base64string = base64.encodestring('%s:%s' % (login, password))[:-1]headers = {'Authorization': "Basic %s" % base64string}url = "http://twitter.com/statuses/update.xml"result = urlfetch.fetch(url, payload=payload, method=urlfetch.POST, headers=headers)self.response.out.write(result.content)def main():application = webapp.WSGIApplication([('/', WeatherText),('/updateweather',UpdateWeather)],debug=True)wsgiref.handlers.CGIHandler().run(application)You can see the results at twitter.com/wycombeweather and wycombeweather.appspot.com. If you want to do it for your local UK weather you'll need to change the figure 2111 above and use your own twitter account.

