Fix PEP-8 formatting recommendations in the webapi module.

This fixes a series of warnings from the pep8 tool involving extra
blank lines and the formatting around a query calculation for diffs.

Reviewed at https://reviews.reviewboard.org/r/6640/