Python script logging and posting in a Discuz forum
#!/usr/bin/python3 # -*- coding: utf-8 -*- import logging import re import requests class AutoDiscuz: LOGIN_URL = "/member.php?mod=logging&action=login&loginsubmit=yes" LOGIN_POST = {"username": "", "password": ""} def __init__(self, forum_url, user_name, password): """初始化论坛 url、用户名、密码和代理服务器.""" self.forum_url = forum_url self.user_name = user_name self.password = password self.formhash = None self.is_login = False self.session = requests.Session() logging.basicConfig(level=logging.INFO, format="[%(levelname)1.1s %(asctime)s] %(message)s") def login(self): """登录论坛.""" [...]