Py-StackExchange filter by tag

2019-02-15 02:23发布

I'm using Py-StackExchange to get a list of recent questions from Stack Overflow. I know there is a way to get just a constant list of questions:

import stackexchange

so = stackexchange.Site(stackexchange.StackOverflow)

for question in so.questions(pagesize=10):
    print question

But this returns all questions across SO. I'm wondering if there is a parameter to filter the questions list by tag, i.e. python, loops, etc to only return questions in that tag. I've been cruising the web for almost an hour searching for results, even reading through some of the scripts, but I can't find anything.

1条回答
该账号已被封号
2楼-- · 2019-02-15 02:30

Use tagged keyword argument.

For example:

for question in so.questions(tagged=['python'], pagesize=10):
    print question
    assert 'python' in question.tags

Specifying tagged=['python', 'loops'] will filter question that is tagged both python and loops.

查看更多
登录 后发表回答