def processMicropub(data):
    if request.method == 'POST':
        if data['action'] not in ('entry',):
            return ('Micropub CREATE requires a valid action parameter', 400, [])
        else:
            location = None
            code     = 400
            action   = data['action'].lower()

            if action == 'entry':
                location, code = handleEntry(data)

            if code in (200,202,):
                return ('Micropub CREATE %s successful for %s' % (action, location), code, {'Location': location})
            else:
                return ('Micropub CREATE %s failed for %s' % (action, location), code, {})
    else:
        return ('Unable to process Micropub %s' % request.method, 400, [])
dataset/ETHPy150Open bear/python-indieweb/indieweb.py/processMicropub/original