import requests from bs4 import BeautifulSoup import mechanize import time import datetime import traceback import json with open("config.json", "r") as fp: config = json.load(fp) USERNAME = config["username"] PASSWORD = config["password"] WEBHOOK_URL = config["webhook"] LOGOUT = config["logout"] BROWSER = mechanize.Browser() def login(): login_url = "https://www.giantswd.org/forum/ucp.php?mode=login" # Login print("Logging in...") BROWSER.open(login_url) BROWSER.select_form(id="login") BROWSER["username"] = USERNAME BROWSER["password"] = PASSWORD BROWSER.submit() def is_logged_in(): if not BROWSER.response(): return False return b'