def main(): compname,ids = connections.link_competitorlist() counter=0 #list to store returned items updatedList =[] update = False for compid in ids: # # Pass it in to the app... app = connections.linkedin_connect() #linkedin.LinkedInApplication(connections.linkedin_connect()) updates = app.get_company_updates(compid,params={'count': 200}) #get list of updateids from KeenIO to cross check compupdateIds = getidList(compname[counter]) try: print compupdateIds[0]["result"] except: print "no entry: Creating" #means no entry in keen, add entry client.add_event(keencollect, {"channel":"LinkedIn","competitor":compname[counter],"data":None}) compupdateIds = getidList(compname[counter]) print compupdateIds[0]["result"] for a in updates["values"]: print a["updateContent"].keys() if a["updateContent"].has_key("companyStatusUpdate"): print compupdateIds[0]["result"] print a["updateContent"]["companyStatusUpdate"]["share"]["id"] if len(compupdateIds[0]["result"]) > 0: for test in compupdateIds[0]["result"]: if test == a["updateContent"]["companyStatusUpdate"]["share"]["id"]: update = False break else: update = True else: update = True if update: updatedList.append(mainUpdate(a["updateContent"]["companyStatusUpdate"]["share"],compname[counter],compid)) print "create item" elif a["updateContent"].has_key("companyJobUpdate"): print "id %r" % a["updateContent"]["companyJobUpdate"]["job"]["id"] if len(compupdateIds[0]["result"]) > 0: for tester in compupdateIds[0]["result"]: if tester == a["updateContent"]["companyJobUpdate"]["job"]["id"]: update = False break else: update = True else: update = True if update: updatedList.append(jobupdate(a["updateContent"],compname[counter],compid)) print "create job" counter= counter +1 print updatedList #return the updated list return updatedList
def getAccountId(id): app = connections.linkedin_connect() updates = app.get_company_updates(id,params={'count': 200}) print updates