Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not seem to fetch more than 20 posts per topic #41

Open
gandharvbakshi opened this issue Sep 5, 2020 · 1 comment
Open

Does not seem to fetch more than 20 posts per topic #41

gandharvbakshi opened this issue Sep 5, 2020 · 1 comment

Comments

@gandharvbakshi
Copy link

Hi,
So the client.posts(topic_id) function seems to fetch only the first 20 posts. Is there a way to get all the posts? My code (without the confidential data) is as below:

client = DiscourseClient('http://example.com', api_username='username', api_key='areallylongstringfromdiscourse')

print(len(client.posts(topic_id).get('post_stream').get('posts'))) - This prints out 20 and returns only 20 posts for all topics with > 20 posts. Where the number of posts is < 20, it prints out that correct number.

@goetzk
Copy link
Collaborator

goetzk commented Feb 2, 2021

We don't appear to be limiting in the code.
https://github.com/bennylope/pydiscourse/blob/master/pydiscourse/client.py#L571

The upstream API documentation doesn't mention a limit but says posts is "for a single post"
https://docs.discourse.org/#tag/Posts/paths/~1posts.json/post

Perhaps check if you're being paginated?

@goetzk goetzk added the question label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants