-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_telethon.py
More file actions
53 lines (43 loc) · 1.46 KB
/
test_telethon.py
File metadata and controls
53 lines (43 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test script for telethon import and basic functionality
"""
import os
import sys
# Load environment variables
def load_env_file():
try:
with open('.env', 'r') as f:
for line in f:
if line.strip() and not line.startswith('#'):
key, value = line.strip().split('=', 1)
os.environ[key] = value
except FileNotFoundError:
print("Warning: .env file not found")
load_env_file()
print("🧪 Testando importação do telethon...")
print(f"🔍 Python version: {sys.version}")
print(f"🔍 Python path: {sys.executable}")
try:
import telethon
print(f"✅ Telethon importado: {telethon.__version__}")
except ImportError as e:
print(f"❌ Erro importando telethon: {e}")
sys.exit(1)
try:
from telethon import TelegramClient
print("✅ TelegramClient importado com sucesso")
except ImportError as e:
print(f"❌ Erro importando TelegramClient: {e}")
sys.exit(1)
# Check credentials
TELEGRAM_API_ID = os.getenv('TELEGRAM_API_ID')
TELEGRAM_API_HASH = os.getenv('TELEGRAM_API_HASH')
print(f"🔍 API_ID: {'✅' if TELEGRAM_API_ID else '❌'}")
print(f"🔍 API_HASH: {'✅' if TELEGRAM_API_HASH else '❌'}")
if not TELEGRAM_API_ID or not TELEGRAM_API_HASH:
print("❌ Credenciais não encontradas no .env")
sys.exit(1)
print("✅ Todas as verificações passaram!")
print("🚀 Telethon está funcionando corretamente")