符合条件的GET请求github api

时间:2013-12-10 17:44:04

标签: github-api

有没有办法使用GET请求过滤github事件?

例如,我可以预先形成一个返回repo事件子集(ForkEvents)的GET吗?:

伪请求(虽然这不起作用): GET / repos /:owner /:repo / events?type = ForkEvent

更普遍的是有没有办法隐式过滤GET请求中的响应数据,即在数据到达我的代码之前? (我是github-api和RESTful API的新手,所以如果这是一个毫无头绪的问题,我会提前道歉)

由于

1 个答案:

答案 0 :(得分:0)

如果Events Documentation是正确的,那么看起来这实际上是不可能的。如果您是GitHub API的新手,您应该尝试使用它存在的库。例如,如果您使用的是python和github3.py,那么您可能会执行以下操作:

import github3

g = github3.login("nelag", "nelag's password")
r = g.repository("nelag", "nelags_repo")
forks = filter(lambda event: event.type == 'ForkEvent', r.iter_events())

简单明了,你的代码就会变得懒惰。