diff --git a/buzz_gae_client.py b/buzz_gae_client.py index 41b6c6b..544655e 100644 --- a/buzz_gae_client.py +++ b/buzz_gae_client.py @@ -96,6 +96,9 @@ class BuzzGaeClient(object): d.update(access_token) return d - def build_api_client(self, oauth_params): - http = oauth_wrap.get_authorised_http(oauth_params) - return apiclient.discovery.build('buzz', 'v1', http = http) + def build_api_client(self, oauth_params=None): + if oauth_params is not None: + http = oauth_wrap.get_authorised_http(oauth_params) + return apiclient.discovery.build('buzz', 'v1', http = http) + else: + return apiclient.discovery.build('buzz', 'v1') diff --git a/buzz_gae_client_tests.py b/buzz_gae_client_tests.py index fea5f68..c318d95 100644 --- a/buzz_gae_client_tests.py +++ b/buzz_gae_client_tests.py @@ -63,5 +63,12 @@ class BuzzGaeClientTest(unittest.TestCase): api_client = client.build_api_client(oauth_parameters) self.assertTrue(api_client is not None) + def test_can_fetch_activites_from_buzz(self): + client = buzz_gae_client.BuzzGaeClient() + api_client = client.build_api_client() + count = 9 + activities = api_client.activities().list(userId='googlebuzz', scope='@self', max_results=count)['items'] + self.assertEquals(count, len(activities)) + if __name__ == '__main__': unittest.main() \ No newline at end of file