Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
2 |
|
3 |
app = FastAPI()
|
4 |
|
5 |
@app.get("/")
|
6 |
def greet_json():
|
7 |
return {"Hello": "World!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
import requests
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
6 |
@app.get("/")
|
7 |
def greet_json():
|
8 |
return {"Hello": "World!"}
|
9 |
+
|
10 |
+
|
11 |
+
@app.get("/kline")
|
12 |
+
def get_kline(symbol : str):
|
13 |
+
res = requests.get("https://api.binance.com/dapi/v1/klines?symbol="+symbol)
|
14 |
+
if res.status_code == 200:
|
15 |
+
return res.json()
|
16 |
+
return {"error":res.text}
|
17 |
+
|