bit.ly



In [1]:
token='XXXXXX'

In [4]:
import bitly_api
c = bitly_api.Connection(access_token=token)
c


Out[4]:
<bitly_api.bitly_api.Connection at 0x24c8290>

In [25]:
results = c.search( 'trayvon', offset=0, limit=1000000)
len(results)


Out[25]:
130

In [30]:
dates = ([ result['initial'] for result in results ])
dates.sort()
dates[0:10]


Out[30]:
[u'20131007170037',
 u'20131013143735',
 u'20131014145806',
 u'20131015155614',
 u'20131016012914',
 u'20131016014136',
 u'20131016043917',
 u'20131017224413',
 u'20131018141043',
 u'20131018202502']

In [37]:
c.clicks_by_day(shortUrl=results[0]['aggregate_link'] )


Out[37]:
[{u'clicks': [{u'clicks': 1, u'day_start': 1382500800},
   {u'clicks': 7, u'day_start': 1382414400},
   {u'clicks': 7, u'day_start': 1382328000},
   {u'clicks': 7, u'day_start': 1382241600},
   {u'clicks': 10, u'day_start': 1382155200},
   {u'clicks': 63, u'day_start': 1382068800},
   {u'clicks': 0, u'day_start': 1381982400}],
  u'global_hash': u'1cC18Q3',
  u'short_url': u'http://bit.ly/1cC18Q3',
  u'user_hash': u'1cC18Q3'}]

In [ ]:


In [21]:
dates


Out[21]:
[u'20131007170037',
 u'20131013143735',
 u'20131014145806',
 u'20131015155614',
 u'20131016012914',
 u'20131016014136',
 u'20131016043917',
 u'20131017224413',
 u'20131018141043',
 u'20131018202502',
 u'20131019014405',
 u'20131019050237',
 u'20131019172858',
 u'20131020152948',
 u'20131021010331',
 u'20131021032004',
 u'20131021044534',
 u'20131021141546',
 u'20131021141655',
 u'20131021150547',
 u'20131021151804',
 u'20131021160157',
 u'20131021160431',
 u'20131021181513',
 u'20131021194937',
 u'20131021235840',
 u'20131022015658',
 u'20131022022316',
 u'20131022043748',
 u'20131022052452',
 u'20131022112110',
 u'20131022140132',
 u'20131022143623',
 u'20131022163027',
 u'20131022164635',
 u'20131022173807',
 u'20131022175840',
 u'20131022181031',
 u'20131022185844',
 u'20131022191945',
 u'20131022192336',
 u'20131022192413',
 u'20131022194901',
 u'20131022195031',
 u'20131022201153',
 u'20131022202041',
 u'20131022202520',
 u'20131022202944',
 u'20131022203219',
 u'20131022204627',
 u'20131022210130',
 u'20131022213033',
 u'20131022214544',
 u'20131022214627',
 u'20131022215127',
 u'20131022222629',
 u'20131022230751',
 u'20131022231424',
 u'20131022231605',
 u'20131023000217',
 u'20131023000717',
 u'20131023000802',
 u'20131023001839',
 u'20131023005504',
 u'20131023010755',
 u'20131023010920',
 u'20131023012946',
 u'20131023014001',
 u'20131023020259',
 u'20131023022311',
 u'20131023024313',
 u'20131023024723',
 u'20131023025632',
 u'20131023030943',
 u'20131023031227',
 u'20131023033057',
 u'20131023033508',
 u'20131023035723',
 u'20131023041021',
 u'20131023043918',
 u'20131023044803',
 u'20131023045212',
 u'20131023045817',
 u'20131023050029',
 u'20131023050348',
 u'20131023051810',
 u'20131023054411',
 u'20131023061644',
 u'20131023063242',
 u'20131023081951',
 u'20131023083438',
 u'20131023090255',
 u'20131023090333',
 u'20131023100258',
 u'20131023101632',
 u'20131023105747',
 u'20131023110605',
 u'20131023112828',
 u'20131023114202',
 u'20131023121040',
 u'20131023130459',
 u'20131023140042',
 u'20131023140455',
 u'20131023141322',
 u'20131023142624',
 u'20131023150151',
 u'20131023150423',
 u'20131023151309',
 u'20131023153535',
 u'20131023153712',
 u'20131023153758',
 u'20131023154713',
 u'20131023155215',
 u'20131023160107',
 u'20131023160317',
 u'20131023160909',
 u'20131023161439',
 u'20131023161613',
 u'20131023162411',
 u'20131023162546',
 u'20131023162907',
 u'20131023164609',
 u'20131023170413',
 u'20131023170413',
 u'20131023170632',
 u'20131023170751',
 u'20131023173325',
 u'20131023175719',
 u'20131023181144',
 u'20131023181431']

In [ ]:


In [ ]: