def googleplusform(): print "From Googel Plus. IP: " + str(request.remote_addr) branches = get_branches() if request.method == "POST": company = request.form['company'] since = request.form['since'] # until = request.form['until'] branch = request.form['branch'] delete = 1 if request.form.get('nodelete') and request.form.get( 'nodelete') == 'on': delete = 0 if not since or str(since).strip() == '': flash("Please give the Since date ") return render_template("googleplusform.html", branches=branches) if company: print "From Google Plus. Company: " + company.strip() pluses = GooglePlusParser(company.strip(), since, delete, branch) return render_template("googleplus.html", pluses=pluses, title="Google+ Data Retrieval") else: flash("Please give a company name") # pass return render_template("googleplusform.html", branches=branches)
def facebookcharts_sums_companies_per_branch(): print "From Facebook Charts. IP: " + str(request.remote_addr) template = "social_charts/facebookcharts_sums_companies_per_branch.html" branches = get_branches() branch = request.form.get('branch') action = request.form.get('param') since = request.form.get('since') until = request.form.get('until') # company = request.form.get('company') data = None if action: if not branch: flash("Please give a Branch") data = getData("deletecompany") template = "social_charts/facebookmorechartsform.html" return render_template( template, branches=branches, nocompany=1, qaction=action, fbs=data, since=since, until=until, msg="Give the dates (optional/experimental):", notlist=0, chart_type="facebookcharts_sums_per_branch", title="Companies sums per Branch") if not since or not until or str(since).strip() == '' or str( until).strip() == '': data = get_fb_sums_per_branch(None, None, branch, 1) else: data = get_fb_sums_per_branch(since, until, branch, 1) else: data = getData("deletecompany") template = "social_charts/facebookmorechartsform.html" return render_template(template, branches=branches, nocompany=1, qaction=action, fbs=data, since=since, until=until, msg="Give the dates (optional/experimental):", notlist=0, chart_type="facebookcharts_sums_per_branch", title="Companies sums per Branch")
def facebookform(): print "From Facebook. IP: " + str(request.remote_addr) branches = get_branches() if request.method == "POST": company = request.form['company'] # population = request.form['population'] since = request.form['since'] until = request.form['until'] branch = request.form['branch'] delete = 1 if request.form.get('nodelete') and request.form.get( 'nodelete') == 'on': delete = 0 # if not population: # population=200 if not since or not until or str(since).strip() == '' or str( until).strip() == '': flash("Please give the Since/Until dates ") return render_template("facebookform.html", branches=branches) if company: print "From Facebook. IP: " + str( request.remote_addr) + " Company: " + company.strip( ) + ", Since:" + since + " Until:" + until # fbs=FBParser([company.strip()], population) fbs, followers, company_name = FBParser([company.strip()], since, until, delete, branch) return render_template("facebook.html", fbs=fbs, followers=followers, company_name=company_name, title="Facebook Data Retrieval") else: flash("Please give a company name") # pass return render_template("facebookform.html", branches=branches)
def facebookcharts_sums_per_weekday_weekend(): print "From Facebook Charts. IP: " + str(request.remote_addr) template = "social_charts/facebookcharts_sums_per_weekday_weekend.html" branches = get_branches() branch = request.form.get('branch') action = request.form.get('param') since = request.form.get('since') until = request.form.get('until') company = request.form.get('company') data = None if action: if not since or not until or str(since).strip() == '' or str( until).strip() == '': data = get_fb_sums_per_weekdays_weekends(company, None, None, branch) else: data = get_fb_sums_per_weekdays_weekends(company, since, until, branch) else: data = getData("deletecompany") template = "social_charts/facebookmorechartsform.html" return render_template( template, company=company, branches=branches, qaction=action, fbs=data, since=since, until=until, msg="Give the dates (optional/experimental):", notlist=0, chart_type="facebookcharts_sums_per_weekday_weekend", title="Companies per weekday/weekend")
def twitterform(): print "From Twitter. IP: " + str(request.remote_addr) branches = get_branches() if request.method == "POST": company = request.form['company'] since = request.form['since'] until = request.form['until'] branch = request.form['branch'] delete = 1 if request.form.get('nodelete') and request.form.get( 'nodelete') == 'on': delete = 0 # if not population: # population=200 if not since or not until or str(since).strip() == '' or str( until).strip() == '': flash("Please give the Since/Until dates ") return render_template("twitterform.html", branches=branches) if company: print "From Twitter. IP: " + str( request.remote_addr) + " Company: " + company.strip( ) + ", Since:" + since + " Until:" + until tweets = TwitterParser(company.strip(), since, until, delete, branch) return render_template("twitter.html", tweets=tweets, title="Tweeter Data Retrieval") else: flash("Please give a company name") # pass return render_template("twitterform.html", branches=branches)
def twittercharts_sums_per_char_range(): branches = get_branches() branch = request.form.get('branch') print "From Twitter Charts. IP: " + str(request.remote_addr) template = "social_charts/twittercharts_sums_per_char_range.html" action = request.form.get('param') since = request.form.get('since') until = request.form.get('until') company = request.form.get('company') data = None if action: if not since or not until or str(since).strip() == '' or str( until).strip() == '': data = get_twitter_sums_per_char_range(company, None, None, branch) else: data = get_twitter_sums_per_char_range(company, since, until, branch) else: data = getTData("deletecompany") template = "social_charts/twittermorechartsform.html" # return render_template(template, tweets=data, title="Twitter Data Retrieval") return render_template(template, company=company, branches=branches, qaction=action, tweets=data, since=since, until=until, msg="Give the dates (optional/experimental):", notlist=0, chart_type="twittercharts_sums_per_char_range", title="Companies per character range")