-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (25 loc) · 792 Bytes
/
app.py
File metadata and controls
33 lines (25 loc) · 792 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
33
import eel
import requests
eel.init("web")
@eel.expose()
def getUsers():
usersData = requests.get("https://jsonplaceholder.typicode.com/users")
if usersData.status_code == 200:
return usersData.json()
else:
print("Internal Server Error!")
@eel.expose()
def getUser(id):
usersData = requests.get("https://jsonplaceholder.typicode.com/posts/" + id)
if usersData.status_code == 200:
return usersData.json()
else:
print("Internal Server Error!")
@eel.expose()
def getImage(id):
imageData = requests.get("https://picsum.photos/id/" + id + "/info")
if imageData.status_code == 200:
return imageData.json()
else:
print("Internal Server Error!")
eel.start("index.html", size = (500, 700))