<commit_before>from flask import Flask, request, jsonify, abort, make_response
from flask_pymongo import PyMongo
from healthcheck import HealthCheck, EnvironmentDump
import requests
import random
from time import sleep
import os


__version__ = '0.1'

# Define default MONGO_URI - Can be modified through environment var
MONGO_URI = 'mongodb://mongo:27017/social_scraps'
MONGO_MAX_POOL_SIZE = '75'

app = Flask(__name__)
app.config['MONGO_URI'] = os.getenv('MONGO_URI', MONGO_URI)
app.config['MONGO_MAX_POOL_SIZE'] = os.getenv('MONGO_MAX_POOL_SIZE', MONGO_MAX_POOL_SIZE)

# wrap the flask app and give a heathcheck url
health = HealthCheck(app, "/healthz")
envdump = EnvironmentDump(app, "/envz")

mongo = PyMongo(app)


# add your own check function to the healthcheck
def mongo_available():
    result = mongo.db.test.insert_one({'status': 'OK'})

    return True, "mongoDB status"

health.add_check(mongo_available)


# add your own data to the environment dump
def application_data():
    return {"maintainer": "<NAME>",
            "git_repo": "https://github.com/undeadops/giles"}

envdump.add_section("application", application_data)

@app.route("/v1/posts", methods=['POST'])
def create_post():
    """
    Push Post to MongoDB
    """
    if not request.json or not 'process_time' in request.json:
        abort(400)
    else:
        result = mongo.db.twitter.insert_one(request.json)
        return jsonify({'status': result}), 201


# Needs Changing
@app.route('/')
def index():
    return jsonify("hello world")


def main():
    print "%s (v%s) starting up..." % ('giles', __version__)
    app.run(host='0.0.0.0', port=5000, debug=True)


if __name__ == '__main__':
    main()
<commit_msg>changing post to put for http method<commit_after>from flask import Flask, request, jsonify, abort, make_response
from flask_pymongo import PyMongo
from healthcheck import HealthCheck, EnvironmentDump
import requests
import random
from time import sleep
import os


__version__ = '0.1'

# Define default MONGO_URI - Can be modified through environment var
MONGO_URI = 'mongodb://mongo:27017/social_scraps'
MONGO_MAX_POOL_SIZE = '75'

app = Flask(__name__)
app.config['MONGO_URI'] = os.getenv('MONGO_URI', MONGO_URI)
app.config['MONGO_MAX_POOL_SIZE'] = os.getenv('MONGO_MAX_POOL_SIZE', MONGO_MAX_POOL_SIZE)

# wrap the flask app and give a heathcheck url
health = HealthCheck(app, "/healthz")
envdump = EnvironmentDump(app, "/envz")

mongo = PyMongo(app)


# add your own check function to the healthcheck
def mongo_available():
    result = mongo.db.test.insert_one({'status': 'OK'})

    return True, "mongoDB status"

health.add_check(mongo_available)


# add your own data to the environment dump
def application_data():
    return {"maintainer": "<NAME>",
            "git_repo": "https://github.com/undeadops/giles"}

envdump.add_section("application", application_data)

@app.route("/v1/posts", methods=['PUT'])
def create_post():
    """
    Push Post to MongoDB
    """
    if not request.json or not 'process_time' in request.json:
        abort(400)
    else:
        result = mongo.db.twitter.insert_one(request.json)
        return jsonify({'status': result}), 201


# Needs Changing
@app.route('/')
def index():
    return jsonify("hello world")


def main():
    print "%s (v%s) starting up..." % ('giles', __version__)
    app.run(host='0.0.0.0', port=5000, debug=True)


if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.13010501750291714, 'fraction_numerical': 0.014002333722287048, 'mean_word_length': 4.4, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '541085', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1142, 'n_words': 306}