1from pyspark import SparkContext
2sc = SparkContext('local')
3
4from flask import Flask, request
5app = Flask(__name__)
6
7@app.route('/whateverYouWant', methods=['POST']) #can set first param to '/'
8
9def toyFunction():
10 posted_data = sc.parallelize([request.get_data()])
11 return str(posted_data.collect()[0])
12
13if __name__ == '__main_':
14 app.run(port=8080) #note set to 8080!