在web.py中如何接收POST过来的XML文件?

93 views
Skip to first unread message

yoo

unread,
Jan 30, 2013, 3:29:04 AM1/30/13
to pyth...@googlegroups.com
想写个微信的自动回复程序,但是不清楚在web.py中如何接收微信POST过来的XML文件。

yoo

unread,
Jan 30, 2013, 6:10:19 AM1/30/13
to pyth...@googlegroups.com
再补充下问题,我是用web.data()接收过来的,但不知道怎么把接收到的内容转换为xml,貌似接收到的是String。

下面是被转发的邮件:

发件人: yoo <yoo...@gmail.com>
主题: 在web.py中如何接收POST过来的XML文件?
日期: 2013年1月30日 GMT+0800下午4时29分04秒

想写个微信的自动回复程序,但是不清楚在web.py中如何接收微信POST过来的XML文件。

狗尾草

unread,
Jan 30, 2013, 6:29:02 AM1/30/13
to python-cn

xml你想怎么处理?如果用正则string直接可以搞。

--
--
邮件来自: `CPyUG`华蟒用户组(中文Python技术邮件列表)
规则: http://code.google.com/p/cpyug/wiki/PythonCn
发言: pyth...@googlegroups.com
退订: python-cn+...@googlegroups.com (向此发空信即退!)
详情: http://code.google.com/p/cpyug/wiki/CpyUg
G+: https://plus.google.com/u/0/communities/108786798869709602787
严正: 理解列表! 智慧提问! http://wiki.woodpecker.org.cn/moin/AskForHelp
---
您收到此邮件是因为您订阅了 Google 网上论坛的“python-cn(华蟒用户组,CPyUG 邮件列表)”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 python-cn+...@googlegroups.com
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
 
 

yoo

unread,
Jan 30, 2013, 6:30:18 AM1/30/13
to pyth...@googlegroups.com
呃,就是正则弱爆了想搞xml.....

sillyou su

unread,
Jan 30, 2013, 6:54:29 AM1/30/13
to pyth...@googlegroups.com
pyquery合适不? http://pypi.python.org/pypi/pyquery

pyquery allows you to make jquery queries on xml documents. The API is as much as possible the similar to jquery. pyquery uses lxml for fast xml and html manipulation.

美丽汤或者也可以?
苏沛

反过来走走

unread,
Jan 30, 2013, 8:27:28 AM1/30/13
to pyth...@googlegroups.com

yegle

unread,
Jan 30, 2013, 8:51:14 AM1/30/13
to pyth...@googlegroups.com
标准哭里有xml解析的库,虽然sax风格比较蛋疼

cloverstd

unread,
Jan 30, 2013, 8:54:22 AM1/30/13
to pyth...@googlegroups.com
我用的是 xml.etree.ElementTree

在 2013年1月30日星期三UTC+8下午4时29分04秒,Yoo写道:
想写个微信的自动回复程序,但是不清楚在web.py中如何接收微信POST过来的XML文件。

@@

unread,
Jan 30, 2013, 9:33:38 AM1/30/13
to pyth...@googlegroups.com
lxml 挺好用的

2013/1/30 cloverstd <clov...@gmail.com>
我用的是 xml.etree.ElementTree

在 2013年1月30日星期三UTC+8下午4时29分04秒,Yoo写道:
想写个微信的自动回复程序,但是不清楚在web.py中如何接收微信POST过来的XML文件。

--

yoo

unread,
Jan 30, 2013, 9:35:48 AM1/30/13
to pyth...@googlegroups.com
谢谢,我照这个方法试试!

yoo

unread,
Jan 30, 2013, 9:36:30 AM1/30/13
to pyth...@googlegroups.com
谢谢,我试试,嗯嗯,要多学习多试验!

李瑾

unread,
Jan 30, 2013, 10:25:16 AM1/30/13
to pyth...@googlegroups.com
lxml

yoo

unread,
Jan 30, 2013, 10:45:41 AM1/30/13
to pyth...@googlegroups.com
呃,又出问题了,有没有人在 Mac上安装lxml成功的?

yegle

unread,
Jan 30, 2013, 10:51:02 AM1/30/13
to pyth...@googlegroups.com

猛禽

unread,
Jan 31, 2013, 10:37:17 AM1/31/13
to pyth...@googlegroups.com
装最新版的XCode或命令行工具,然后pip install lxml应该就可以了,记得以前是这么装上的。

在 2013年1月30日星期三UTC+8下午11时45分41秒,Yoo写道:

yoo

unread,
Feb 1, 2013, 3:22:10 AM2/1/13
to pyth...@googlegroups.com
试了试pip也装不上,升级了最新的Xcode,我在Ubuntu上装了lxml,很好用,谢谢各位大大,如果有谁知道Mac上如何安装还请告诉我,谢谢!
Reply all
Reply to author
Forward
0 new messages