<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask
from flask import render_template
from flask import request
from api import *

app = Flask(__name__)

@app.route("/")
def index():
    return render_template("index.html")

@app.route("/<name>")
def hello(name):
    return render_template("index.html",name=name.title())

@app.route("/signup", methods=['POST'])
def sign_up():
    form_data = request.form
    name = form_data['name']
    print name
    print form_data['email']
    return render_template("signup.html",name=name.title())


@app.route("/email", methods=['POST'])
def email():
    to = "Maria <<EMAIL>>",
    subject = "Hello Maria",
    msg = "Congratulations Maria, you just sent an email with Mailgun!  You are truly awesome!  " \
            "You can see a record of this email in your logs: https://mailgun.com/cp/log .  " \
            "You can send up to 300 emails/day from this sandbox server. "
    m = Mailgun()
    result = m.send(to,subject,msg)
    return render_template("index.html", email=result.status_code)


@app.route("/weather", methods=['POST'])
def weather():
    w = Weather()
    form_data = request.form
    name = form_data['city']
    result = w.weatherByCity(name).json()
    print result
    temp = result['main']['temp']
    city = result['name']
    country = result['sys']['country']
    weather = result['weather'][0]['main']
    print temp, city, country, weather
    msg = u"It's {}ºC in {} {}, and the sky is {} ".format(temp, city, country, weather)
    return render_template("index.html", weather=msg)

@app.route("/tweets", methods=['POST'])
def twitter():
    t = Twitter()
    form_data = request.form
    tag = form_data['tag']
    result = t.getTweetsForTag(tag)
    tweets = []
    for tweet in result:
        tweets.append(u"{} - {}".format(tweet.user.name,tweet.text))
    return render_template("index.html", tweets=tweets)

@app.route("/foursquare", methods=['POST'])
def foursquare():
    f = Foursquare()
    form_data = request.form
    location = form_data['location']
    result = f.exploreVenues(location).json()
    venues = []
    for item in result['response']['groups'][0]['items']:
        name = item['venue']['name']
        rating = item['venue']['rating']
        address = ", ".join(item['venue']['location']['formattedAddress'])
        venues.append(u"Name: {}, Rating: {}, Address: {}".format(name, rating, address))
    return render_template("index.html", venues=venues)

@app.route("/uber", methods=['POST'])
def uber_product():
    u = UberRides()
    form_data = request.form
    longitude = form_data['longitude']
    latitude = form_data['latitude']
    products = u.getProducts(longitude, latitude)
    return render_template("index.html", products=products)

@app.route("/aftership", methods=['POST'])
def aftership_Create_Shipment():
    a = AfterShip()
    form_data = request.form
    slug = form_data['slug']
    number = form_data['number']
    title = form_data['title']
    ShipmentInfo = a.createShipment(slug,number,title)
    return render_template("index.html", ShipmentInfo=ShipmentInfo)

if __name__ == "__main__":
    app.debug = True
    app.run()<commit_msg>cloud9 integration<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask import render_template
from flask import request
from api import *

app = Flask(__name__)

@app.route("/")
def index():
    return render_template("index.html")

@app.route("/<name>")
def hello(name):
    return render_template("index.html",name=name.title())

@app.route("/signup", methods=['POST'])
def sign_up():
    form_data = request.form
    name = form_data['name']
    print name
    print form_data['email']
    return render_template("signup.html",name=name.title())


@app.route("/email", methods=['POST'])
def email():
    to = "Maria <<EMAIL>>",
    subject = "Hello Maria",
    msg = "Congratulations Maria, you just sent an email with Mailgun!  You are truly awesome!  " \
            "You can see a record of this email in your logs: https://mailgun.com/cp/log .  " \
            "You can send up to 300 emails/day from this sandbox server. "
    m = Mailgun()
    result = m.send(to,subject,msg)
    return render_template("index.html", email=result.status_code)


@app.route("/weather", methods=['POST'])
def weather():
    w = Weather()
    form_data = request.form
    name = form_data['city']
    result = w.weatherByCity(name).json()
    print result
    temp = result['main']['temp']
    city = result['name']
    country = result['sys']['country']
    weather = result['weather'][0]['main']
    print temp, city, country, weather
    msg = u"It's {}ºC in {} {}, and the sky is {} ".format(temp, city, country, weather)
    return render_template("index.html", weather=msg)

@app.route("/tweets", methods=['POST'])
def twitter():
    t = Twitter()
    form_data = request.form
    tag = form_data['tag']
    result = t.getTweetsForTag(tag)
    tweets = []
    for tweet in result:
        tweets.append(u"{} - {}".format(tweet.user.name,tweet.text))
    return render_template("index.html", tweets=tweets)

@app.route("/foursquare", methods=['POST'])
def foursquare():
    f = Foursquare()
    form_data = request.form
    location = form_data['location']
    result = f.exploreVenues(location).json()
    venues = []
    for item in result['response']['groups'][0]['items']:
        name = item['venue']['name']
        rating = item['venue']['rating']
        address = ", ".join(item['venue']['location']['formattedAddress'])
        venues.append(u"Name: {}, Rating: {}, Address: {}".format(name, rating, address))
    return render_template("index.html", venues=venues)

@app.route("/uber", methods=['POST'])
def uber_product():
    u = UberRides()
    form_data = request.form
    longitude = form_data['longitude']
    latitude = form_data['latitude']
    products = u.getProducts(longitude, latitude)
    return render_template("index.html", products=products)

@app.route("/aftership", methods=['POST'])
def aftership_Create_Shipment():
    a = AfterShip()
    form_data = request.form
    slug = form_data['slug']
    number = form_data['number']
    title = form_data['title']
    ShipmentInfo = a.createShipment(slug,number,title)
    return render_template("index.html", ShipmentInfo=ShipmentInfo)

app.run(host=os.getenv('IP', '0.0.0.0'),port=int(os.getenv('PORT', 8080)))
{'fraction_non_alphanumeric': 0.16842923794712286, 'fraction_numerical': 0.003265940902021773, 'mean_word_length': 3.8317054845980465, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6994419', 'n_tokens_mistral': 2073, 'n_tokens_neox': 2040, 'n_words': 473}