So, I made a query using Stack Exchange Data Explorer:
SELECT TOP 100 Id
AS [Post Link],
ViewCount,
AnswerCount,
FavoriteCount,
CommentCount,
Score,
Tags
FROM Posts
ORDER BY ViewCount DESC
It returns just what I need, but I need to retrieve this by a python script.
Using the StackAPI, I can retrieve the questions, but I can't sort it by view_count
.
I was trying to retrieve to the API like that:
from stackapi import StackAPI
SITE = StackAPI('stackoverflow')
SITE.max_pages=1
top_viewed_questions = SITE.fetch('questions', sort='view_count', order='desc')
print(top_viewed_questions)
But it looks like view_count
can't be sorted. Am I sorting wrong the view_count
or there's no way I can do that?