Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -1,22 +1,24 @@
|
|
1 |
-
import httpx
|
2 |
from fastapi import FastAPI, Request
|
3 |
|
4 |
TOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"
|
5 |
BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
|
6 |
|
7 |
-
client = httpx.AsyncClient()
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
11 |
-
@app.post("/
|
12 |
-
|
13 |
print('a')
|
14 |
-
|
|
|
|
|
15 |
print(data)
|
16 |
chat_id = data['message']['chat']['id']
|
17 |
text = data['message']['text']
|
18 |
await client.get(f"{BASE_URL}/sendMessage?chat_id={chat_id}&text={text}")
|
19 |
-
return data
|
20 |
|
21 |
@app.get("/")
|
22 |
def read_general():
|
|
|
1 |
+
#import httpx
|
2 |
from fastapi import FastAPI, Request
|
3 |
|
4 |
TOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"
|
5 |
BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
|
6 |
|
7 |
+
#client = httpx.AsyncClient()
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
11 |
+
@app.post("/")
|
12 |
+
def webhook(req: Request):
|
13 |
print('a')
|
14 |
+
print(req)
|
15 |
+
return {"response": "TEST"}
|
16 |
+
'''data = await req()
|
17 |
print(data)
|
18 |
chat_id = data['message']['chat']['id']
|
19 |
text = data['message']['text']
|
20 |
await client.get(f"{BASE_URL}/sendMessage?chat_id={chat_id}&text={text}")
|
21 |
+
return data'''
|
22 |
|
23 |
@app.get("/")
|
24 |
def read_general():
|