首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >python调用简单机器论坛urllib2

python调用简单机器论坛urllib2
EN

Stack Overflow用户
提问于 2015-03-11 14:06:59
回答 1查看 251关注 0票数 0

请查找下面的代码

代码语言:javascript
运行
复制
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提要时,大多数时候给出的数据都是错误的。

有没有人可以让我知道我是否应该传递任何其他查询参数。谢谢

EN

回答 1

Stack Overflow用户

发布于 2019-04-21 02:09:10

试试这个:https://github.com/bithon/python-simplemachinesforum

代码语言:javascript
运行
复制
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!")
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28979711

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档