def AddShortLink(blip, wave_id): wave_url = 'https://wave.google.com/wave/#restored:wave:%s' % wave_id wave_url = wave_url.replace('#', '%23') wave_url = wave_url.replace('+', '%252B') bitly = BitLy(bitlycred.LOGIN, bitlycred.KEY) short_url = bitly.shorten(wave_url) ModBlip(blip, short_url, [('link/manual', short_url), ('style/fontSize', '1.5em')]) ModBlip(blip, '\n', [('link/manual', None), ('style/fontSize', None)])
def testShortenURL(self): bitly = BitLy(bitlycred.LOGIN, bitlycred.KEY) short_url = bitly.shorten('http://www.chrishannam.co.uk') print short_url