File size: 502 Bytes
d24bd61
0c0cb55
6915dbd
 
 
d24bd61
 
 
0c0cb55
 
 
182e38e
 
4c69c57
 
182e38e
4c69c57
182e38e
84fef6e
0c0cb55
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from fastapi import FastAPI
import requests

app = FastAPI()

@app.get("/")
def greet_json():
    return {"Hello": "World!"}


@app.get("/kline")
def get_kline(symbol : str, proxy: str):
    proxies = {
        "http":"http://"+proxy,
        "https":"https://"+proxy
    }
    print(proxy)
    res = requests.get("https://api.binance.com/dapi/v1/klines?symbol="+symbol, proxies=proxies)
    print(res.headers)
    if res.status_code == 200:
        return res.json()
    return {"error":res.text}