コード例 #1
0
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)])
コード例 #2
0
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)])
コード例 #3
0
ファイル: bitlytest.py プロジェクト: mattorb/feedertweeter
 def testshorten(self): 
     bitly = BitLy(BITLY_LOGIN, BITLY_API_KEY)
     url = 'www.yahoo.com'
     self.assertEquals('http://bit.ly/bxUHoc', bitly.shorten(url)['results']['http://' + url]['shortUrl'])
     self.assertEquals(2, bitly.stats('http://bit.ly/bxUHoc')['results']['userClicks'])
コード例 #4
0
ファイル: tweetwriter.py プロジェクト: mattorb/feedertweeter
def buildbitlyshortener():
    bitly = BitLy(BITLY_LOGIN, BITLY_API_KEY)
    return lambda x:bitly.shorten(x.replace('http://', ''))['results']['http://' + x.replace('http://', '')]['shortUrl']
コード例 #5
0
 def testShortenURL(self):
     bitly = BitLy(bitlycred.LOGIN, bitlycred.KEY)
     short_url = bitly.shorten("http://www.chrishannam.co.uk")
     print short_url
コード例 #6
0
 def testShortenURL(self):
     bitly = BitLy(bitlycred.LOGIN, bitlycred.KEY)
     short_url = bitly.shorten('http://www.chrishannam.co.uk')
     print short_url