def return_latest_tweets_by_query(): """ get list of latest tweets, locations, sentiment, and time --- parameters: - name: location in: query type: string required: true default: osaka responses: 200: description: returns a json list of tweets schema: id: predictionGet properties: results: type: json default: setosa status: type: number default: 200 """ if request.method == 'GET': query_input = request.args.get('location') elif request.method == 'POST': query_input = 'osaka' return jsonify(get_tweet_list(query=query_input, count=100))
def return_latest_tweets_by_coord(): """ get list of latest tweets, locations, sentiment, and time --- parameters: - name: lat in: query type: number required: true default: 25.037757 - name: lng in: query type: number required: true default: 121.547187 - name: disaster in: query type: string required: true default: "false" - name: radius in : query type: number required: false default: 1 responses: 200: description: returns a json list of tweets schema: id: predictionGet properties: results: type: json default: setosa status: type: number default: 200 """ lat = float(request.args.get('lat')) lng = float(request.args.get('lng')) disaster_switch = request.args.get('disaster') if disaster_switch == "true": disaster_switch = True else: disaster_switch = False rad = float(request.args.get('radius')) req = {"lat": lat, "lng": lng, "disaster": disaster_switch, "radius": rad} response = {"results": get_tweet_list(query=req), "status": 1} return jsonify(response)
def aframe_by_query(): try: location_query = request.args.get('location') except: return 'no location specified' # run the aframe creation location_map = make_here_maps_request_url(location=location_query) location_tweets = { "results": get_tweet_list(query=location_query, count=30), "status": 1 } return render_template("aframe.html", location=location_map, tweet_content=location_tweets)
def nn_prediction(): """ get list of latest tweets, locations, sentiment, and time --- parameters: - name: s_length in: query type: number required: true - name: s_width in: query type: number required: true - name: p_length in: query type: number required: true - name: p_width in: query type: number required: true responses: 200: description: All is well. you get your results as a json with a string describing classes schema: id: predictionGet properties: results: type: json default: setosa status: type: number default: 200 """ response = get_tweet_list() output = { "results": response, "status": 200 } return jsonify(output)