Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ import uvicorn
|
|
| 20 |
import random
|
| 21 |
import docx # لإضافة دعم .docx
|
| 22 |
|
| 23 |
-
# ==========
|
| 24 |
import httpx
|
| 25 |
import dns.asyncresolver
|
| 26 |
from httpx import AsyncClient, AsyncHTTPTransport, Request, Response
|
|
@@ -52,7 +52,7 @@ REPO_ID = "Riy777/Study"
|
|
| 52 |
SELECTING_SUBJECT, SELECTING_ACTION, WAITING_FOR_QUESTION = range(3)
|
| 53 |
|
| 54 |
|
| 55 |
-
# ==========
|
| 56 |
class CustomDNSTransport(AsyncHTTPTransport):
|
| 57 |
def __init__(self, *args, **kwargs):
|
| 58 |
super().__init__(*args, **kwargs)
|
|
@@ -904,8 +904,7 @@ async def root():
|
|
| 904 |
</html>
|
| 905 |
"""
|
| 906 |
|
| 907 |
-
# ========== !!
|
| 908 |
-
# تمت إضافة response_model=None لحل مشكلة FastAPIError
|
| 909 |
@app.post("/telegram", response_model=None)
|
| 910 |
async def handle_telegram_update(request: Request):
|
| 911 |
"""معالجة تحديثات Telegram"""
|
|
|
|
| 20 |
import random
|
| 21 |
import docx # لإضافة دعم .docx
|
| 22 |
|
| 23 |
+
# ========== إضافة المكتبات الصحيحة لحل مشكلة DNS + Lifespan ==========
|
| 24 |
import httpx
|
| 25 |
import dns.asyncresolver
|
| 26 |
from httpx import AsyncClient, AsyncHTTPTransport, Request, Response
|
|
|
|
| 52 |
SELECTING_SUBJECT, SELECTING_ACTION, WAITING_FOR_QUESTION = range(3)
|
| 53 |
|
| 54 |
|
| 55 |
+
# ========== فئة الناقل المخصص للـ DNS ==========
|
| 56 |
class CustomDNSTransport(AsyncHTTPTransport):
|
| 57 |
def __init__(self, *args, **kwargs):
|
| 58 |
super().__init__(*args, **kwargs)
|
|
|
|
| 904 |
</html>
|
| 905 |
"""
|
| 906 |
|
| 907 |
+
# ========== !! تأكد من وجود response_model=None هنا !! ==========
|
|
|
|
| 908 |
@app.post("/telegram", response_model=None)
|
| 909 |
async def handle_telegram_update(request: Request):
|
| 910 |
"""معالجة تحديثات Telegram"""
|