(hopefully) finalize api.py upgrade to flask
(hopefully) finalize api.py upgrade to flask

Correctly handles error reporting, removes some unused imports, and a
bit of code cleanup.

cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo