Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import asyncio
- from telegram import Bot
- # Credentials
- login_url = 'https://wingoxd.in/api/webapi/login'
- username = '7777777777'
- password = '7777777777'
- telegram_token = '7115429644:AAEj6kHov3nGO5L9EdBzPbWXx-6zdw-IBSo'
- telegram_chat_id = '-1002030982037'
- # Initialize Telegram bot
- bot = Bot(token=telegram_token)
- # Function to handle login and send notification
- async def login_and_notify():
- for attempt in range(3): # Retry login up to 3 times
- try:
- session = requests.Session()
- session.headers.update({'User-Agent': 'Mozilla/5.0'})
- login_data = {'username': username, 'pwd': password}
- response = session.post(login_url, data=login_data)
- if response.status_code == 200 and response.json().get('status') is True:
- await bot.send_message(chat_id=telegram_chat_id, text="✅ Login Successful! ✅")
- return # Exit function if login is successful
- else:
- await bot.send_message(chat_id=telegram_chat_id, text="❌ Login failed. Retrying... ❌")
- except Exception as e:
- print(f"Login attempt {attempt + 1} failed: {e}")
- await asyncio.sleep(5) # Wait before retrying
- # If all attempts fail
- await bot.send_message(chat_id=telegram_chat_id, text="❌ Login failed after multiple attempts. ❌")
- # Run the login and notification process
- if __name__ == "__main__":
- asyncio.run(login_and_notify())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement