Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d276229
Move guts of 'Client.list_topics' to 'Connection.list_topics'.
tseaver Apr 6, 2016
c65cf74
Move guts of 'Client.list_subscriptions' to 'Connection.list_subscrip…
tseaver Apr 6, 2016
356f925
Normalize, reduce boilerplate.
tseaver Apr 6, 2016
3e53eeb
Move guts of 'Topic.create' to 'Connection.topic_create'.
tseaver Apr 6, 2016
2d3f8c2
Move guts of 'Topic.exists' to 'Connection.topic_get'.
tseaver Apr 6, 2016
56005bd
Move guts of 'Topic.delete' to 'Connection.topic_delete'.
tseaver Apr 6, 2016
fe26588
Move guts of 'Topic.publish'/'Batch.commit' to 'Connection.topic_publ…
tseaver Apr 6, 2016
16f1d80
Move guts of 'Topic.list_subscriptions' to 'Connection.topic_list_sub…
tseaver Apr 6, 2016
d81b349
Move guts of 'Topic.get_iam_policy' to 'Connection.get_iam_policy'.
tseaver Apr 6, 2016
154a624
Move guts of 'Topic.set_iam_policy' to 'Connection.set_iam_policy'.
tseaver Apr 6, 2016
086c321
Move guts of 'Topic.check_iam_permissions' to 'Connection.test_iam_pe…
tseaver Apr 6, 2016
cb8dd9d
Move guts of 'Subscription.create' to 'Connection.subscription_create'.
tseaver Apr 7, 2016
d5e8660
Move guts of 'Subscription.exists' to 'Connection.subscription_get'.
tseaver Apr 7, 2016
a2ddf7e
Move guts of 'Subscription.reload' to 'Connection.subscription_get'.
tseaver Apr 7, 2016
c40344f
Move guts of 'Subscription.delete' to 'Connection.subscription_delete'.
tseaver Apr 7, 2016
b82b764
Move guts of 'Subscription.modify_push_config' to 'Connection.subscri…
tseaver Apr 7, 2016
5edb73e
Move guts of 'Subscription.pull' to 'Connection.subscription_pull'.
tseaver Apr 7, 2016
d19da2e
Move guts of 'Subscription.modify_ack_deadline' to 'Connection.subscr…
tseaver Apr 7, 2016
94d81fa
Move guts of 'Subscription.get_iam_policy' to 'Connection.get_iam_pol…
tseaver Apr 7, 2016
ac2670a
Move guts of 'Subscription.set_iam_policy' to 'Connection.set_iam_pol…
tseaver Apr 7, 2016
3707e6d
Move guts of 'Subscription.check_iam_permissions' to 'Connection.test…
tseaver Apr 7, 2016
1135b6f
Fix py34 JSON marshalling of message payload bytes.
tseaver Apr 7, 2016
f7ea446
Break out definition of 'path' for clarity.
tseaver Apr 8, 2016
9adf05b
Add ':rtype:' and ':returns:' for Connection methods.
tseaver Apr 8, 2016
a8ee698
Make 'Connection.topic_publish' return a bare list of message IDs.
tseaver Apr 8, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 10 additions & 27 deletions gcloud/pubsub/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,12 @@ def list_topics(self, page_size=None, page_token=None):
more topics can be retrieved with another call (pass that
value as ``page_token``).
"""
params = {}

if page_size is not None:
params['pageSize'] = page_size

if page_token is not None:
params['pageToken'] = page_token

path = '/projects/%s/topics' % (self.project,)
resp = self.connection.api_request(method='GET', path=path,
query_params=params)
conn = self.connection
resources, next_token = conn.list_topics(

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

self.project, page_size, page_token)
topics = [Topic.from_api_repr(resource, self)
for resource in resp.get('topics', ())]
return topics, resp.get('nextPageToken')
for resource in resources]
return topics, next_token

def list_subscriptions(self, page_size=None, page_token=None):
"""List subscriptions for the project associated with this client.
Expand All @@ -104,23 +96,14 @@ def list_subscriptions(self, page_size=None, page_token=None):
more topics can be retrieved with another call (pass that
value as ``page_token``).
"""
params = {}

if page_size is not None:
params['pageSize'] = page_size

if page_token is not None:
params['pageToken'] = page_token

path = '/projects/%s/subscriptions' % (self.project,)

resp = self.connection.api_request(method='GET', path=path,
query_params=params)
conn = self.connection
resources, next_token = conn.list_subscriptions(
self.project, page_size, page_token)
topics = {}
subscriptions = [Subscription.from_api_repr(resource, self,
topics=topics)
for resource in resp.get('subscriptions', ())]
return subscriptions, resp.get('nextPageToken')
for resource in resources]
return subscriptions, next_token

def topic(self, name, timestamp_messages=False):
"""Creates a topic bound to the current client.
Expand Down
Loading