Refactor gbq.py for oauth2 authentication.