请查找下面的代码
import urllib2
post_id = raw_input('Please enter Id of the post to be migrated : ')
smf_url = 'www.simplemachines.org/community/index.php?topic=%s&action=.xml' %(post_id)
req = urllib2.Request(smf_url)
response = urllib2.urlopen(req)
the_page = response.read()
当我删除action=.xml
时,我正在将适当的html内容放入我的浏览器中,以提供主题id。当我尝试获取xml提要时,大多数时候给出的数据都是错误的。
有没有人可以让我知道我是否应该传递任何其他查询参数。谢谢
发布于 2019-04-21 02:09:10
试试这个:https://github.com/bithon/python-simplemachinesforum
from simplemachinesforum.simplemachinesforum import SimpleMachinesForum
smf_url = "https://www.any-simplemachinesforum.com"
smf_user = "user_name"
smf_pass = "password"
smf = SimpleMachinesForum(smf_url, smf_user, smf_pass)
# 1 = board id:
smf.new_topic(1, "subject", "This is the message to post!")
https://stackoverflow.com/questions/28979711
复制相似问题