-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (23 loc) · 755 Bytes
/
main.py
File metadata and controls
32 lines (23 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from fastapi import FastAPI
from trending.repo import RepoSpider
from trending.lang import LangSpider
from trending.user import UserSpider
app = FastAPI(title="GitHub Trending APIs", version="2.0.2", contact={
"name": "Edgar",
"url": "https://github.com/doforce/github-trending",
})
@app.get("/")
def root():
return {"message": "Hello GitHub trending"}
@app.get('/lang')
def lang():
spider = LangSpider()
return spider.get_items()
@app.get('/repo')
def repo(lang: str = "", since: str = "daily"):
spider = RepoSpider(since, lang)
return spider.get_items()
@app.get('/user')
def repo(lang: str = "", since: str = "daily", sponsorable=""):
spider = UserSpider(since, lang, sponsorable)
return spider.get_items()