Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,6 @@
|
|
| 1 |
-
import
|
| 2 |
-
import asyncio
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
async with aiohttp.ClientSession() as session:
|
| 7 |
-
params = {
|
| 8 |
-
'chat_id': chat_id,
|
| 9 |
-
'text': message
|
| 10 |
-
}
|
| 11 |
-
async with session.get(url, params=params) as response:
|
| 12 |
-
if response.status == 200:
|
| 13 |
-
print("Message sent successfully")
|
| 14 |
-
else:
|
| 15 |
-
print(f"Failed to send message: {response.status}")
|
| 16 |
-
|
| 17 |
-
# مثال لاستخدام الدالة
|
| 18 |
-
async def main():
|
| 19 |
-
token = '7865424971:AAF_Oe6lu8ZYAl5XIF1M6qU_8MK6GHWEll8'
|
| 20 |
-
chat_id = '227321236'
|
| 21 |
-
message = 'Hello, this is a test message from Hugging Face Space!'
|
| 22 |
-
await send_message_to_telegram(token, chat_id, message)
|
| 23 |
|
| 24 |
-
|
| 25 |
-
asyncio.run(main())
|
|
|
|
| 1 |
+
import requests
|
|
|
|
| 2 |
|
| 3 |
+
url = "https://api.telegram.org/bot7865424971:AAF_Oe6lu8ZYAl5XIF1M6qU_8MK6GHWEll8/getMe"
|
| 4 |
+
response = requests.get(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
print(response.json())
|
|
|