如何让有相同的标签后的金额

问题描述 投票:0回答:2

目前习惯蟒蛇试图使用stackoverflows API查询的职位数与特定标签。

import requests

BASEURL = "https://api.stackexchange.com/2.2/questions/15112125"

params = {
  "site": "stackoverflow"
}

r = requests.get(BASEURL, params=params)

print(r.json())

尝试使用/questions/tagged/python这是无法得到有关命名标签的信息时,上面的代码工作然而罚款。

python api
2个回答
1
投票

似乎有没有/questions/tagged终点,我认为你需要查询/questions得到的所有的问题的列表

然后以编程方式过滤它们自己的标签列表("tags" JSON场)上,看到这里的问题格式:https://api.stackexchange.com/docs/types/question

一个例子:

{
  "tags": [
    "windows",
    "c#",
    ".net"
  ],
  "owner": {
    "reputation": 9001,
    "user_id": 1,
    "user_type": "registered",
    "accept_rate": 55,
    "profile_image": "https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?d=identicon&r=PG",
    "display_name": "Example User",
    "link": "https://example.stackexchange.com/users/1/example-user"
  },
  "is_answered": false,
  "view_count": 31415,
  "favorite_count": 1,
  "down_vote_count": 2,
  "up_vote_count": 3,
  "answer_count": 0,
  "score": 1,
  "last_activity_date": 1549253581,
  "creation_date": 1549210381,
  "last_edit_date": 1549278781,
  "question_id": 1234,
  "link": "https://example.stackexchange.com/questions/1234/an-example-post-title",
  "title": "An example post title",
  "body": "An example post body"
}

还有那个端点tags/{tag}/top-askers/{period}让高层问题,提问者在一个特定的标签,无论是在上个月或所有的时间。见doc


0
投票

你不能基于标签您尝试的方式的问题,但你可以考虑使用此终结,让你的根据自己喜爱的标签或如果你没有任何喜欢的标签这是没有答案的问题清单,它会给您更常用的标签相关的悬而未决的问题。从文档,

请注意,仅仅因为一个问题有一个答案,这并不意味着它被认为是回答。虽然规则如有变动,此时一个问题必须要考虑至少一个upvoted答案回答。

这种方法与解答“”我的标签“”标签大致对应。

此方法请求的access_token。

除此之外,@Bentaye上面指出的方式看起来是正确的。

© www.soinside.com 2019 - 2024. All rights reserved.