How can I pass parameters to the bit.ly api using python? -


i'm trying pass in parameters link_clicks , link_countries bit.ly apis python i'm not sure of syntax pass parameters here. how can add parameters api call?

import sys import bitly_api import os config import config   #connect bitly conn_btly = bitly_api.connection(access_token=config['access_token'])  #get links links = conn_btly.user_link_history()  print 'links okay'   link in links:      #add params link     link_full = link['link'] + '?rollup=false'     print link_full      #get clicks     clicks = conn_btly.link_clicks(link_full)      #print results     #print link['link'], clicks     print clicks 

the resulting output

links okay http://mzl.la/19xsyct?rollup=false ... bitlyerror: not_found 

you need pass in rollup keyword parameter instead:

clicks = conn_btly.link_clicks(link['link'], rollup=false) 

you expected pass in python boolean value. parameter not part of bit.ly url, parameter api call instead.

all optional api parameters (so apart link), passed in keyword parameters, including unit, units, tz_offset , limit.

you can take @ internal method handles these parameters if inclined.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -