Move api call functions into views_api.py
Pep8 fixes