Skip to content

Commit 60b1aca

Browse files
author
Konstantinacc
committed
Added comments to function get_posts in disqus.py file.
1 parent f81bb0b commit 60b1aca

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

codebender_testing/disqus.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,21 @@ def get_posts(self, thread_id):
177177
post_id = None
178178
raw_message = None
179179
try:
180+
""" Returns a Paginator object that matches the desired criteria:
181+
`self.disqus.api.posts.list`: Returns a list of posts ordered by the date created.
182+
`forum`: Looks up a forum by short name.
183+
`thread`: Looks up a thread by ID. Filters results returned from `self.disqus.api.posts.list`
184+
and returns only those which match `forum` and `thread`.
185+
"""
180186
paginator = disqusapi.Paginator(self.disqus.api.posts.list,
181187
forum=FORUM,
182188
thread=thread_id,
183-
order='asc', method='GET')
189+
order='asc')
184190
if paginator:
185-
for result in paginator:
186-
if result['author']['name'] == self.user['username'] and result['author']['url'] == AUTHOR_URL:
187-
post_id = result['id']
188-
raw_message = result['raw_message']
191+
for post in paginator:
192+
if post['author']['name'] == self.user['username'] and post['author']['url'] == AUTHOR_URL:
193+
post_id = post['id']
194+
raw_message = post['raw_message']
189195
break
190196
except Exception as error:
191197
print 'Error:', error

0 commit comments

Comments
 (0)