Update api.py

Fixed accessor in queryset.
Fixed error where period is a string instead of a number
Merge branch 'develop' of https://github.com/prjts/open-budgets into develop
Added .year to period_start in period()