This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmain.py
63 lines (51 loc) · 1.47 KB
/
main.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import json
from types import SimpleNamespace
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
with open('config.json') as f:
config = SimpleNamespace(**(json.loads(f.read())))
from routes import router
__version__ = "0.1.0"
description = """
**Wallpapers API**
All the wallpapers are fetched from <{api_url}>
**This API can be used for setting daily wallpapers on a mobile device by combining it with an app such as IFTTT**
""".format(api_url=config.wallpaper_api_url)
tags_metadata = [
{
"name": "Random Wallpapers",
"description": "Returns a completely random wallpaper",
},
{
"name": 'Collections',
"description": "Working with collections, a collection contains wallpapers."
},
{
"name": "Category",
"description": "Workig with categories, a category contains collections"
},
{
"name": "Search",
"description": "Search for collections"
},
{
'name': 'Wallpaper',
'description': 'Get wallpaper by it\'s name'
}
]
contact = {
"name": "Adnan Ahmad",
"url": "http://viperadnan-git.github.io",
"email": "viperadnan@gmail.com",
}
app = FastAPI(
title="Wallpapers API",
description=description,
version=__version__,
contact=contact,
openapi_tags=tags_metadata,
docs_url="/docs",
redoc_url="/redocs",
)
app.mount("/static", StaticFiles(directory="web/static"), name="static")
app.include_router(router=router)