MatteoScript commited on
Commit
eadded2
·
verified ·
1 Parent(s): 2df0239

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -0
main.py CHANGED
@@ -1,5 +1,6 @@
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}"
@@ -7,6 +8,13 @@ BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
7
  #client = httpx.AsyncClient()
8
 
9
  app = FastAPI()
 
 
 
 
 
 
 
10
 
11
  @app.post("/")
12
  def webhook(req: Request):
 
1
  #import httpx
2
  from fastapi import FastAPI, Request
3
+ from fastapi.middleware.cors import CORSMiddleware # Importa il middleware CORS
4
 
5
  TOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"
6
  BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
 
8
  #client = httpx.AsyncClient()
9
 
10
  app = FastAPI()
11
+ app.add_middleware(
12
+ CORSMiddleware,
13
+ allow_origins=["*"],
14
+ allow_credentials=True,
15
+ allow_methods=["*"],
16
+ allow_headers=["*"],
17
+ )
18
 
19
  @app.post("/")
20
  def webhook(req: Request):