将feedparser与Google App Engine配合使用

Noo*_*oob 2 python google-app-engine feedparser python-2.5

我正在尝试使用feedparser解析RSS提要.为简洁起见,下面的代码剪短了

from google.appengine.api import urlfetch
import feedparser
print 'Content-Type: text/plain'

feed_url = 'http://parsethisurl'
feedinput = urlfetch.fetch(feed_url)

rss_parsed = feedparser.parse(feedinput.content)
......
#some logic here
.........

print "\n".join(episode_info) # printing out the desired output.
Run Code Online (Sandbox Code Playgroud)

我的python解释器工作正常,但当我将我的应用程序添加到gapp引擎启动器并尝试通过localhost:10000它运行它给我以下错误

<type 'exceptions.ImportError'>: No module named feedparser 
      args = ('No module named feedparser',) 
      message = 'No module named feedparser'
Run Code Online (Sandbox Code Playgroud)

feedparser 模块已安装在我的系统上.

>>> sys.version
'2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]'
>>> import feedparser
>>>
Run Code Online (Sandbox Code Playgroud)

我读了一些关于stackoveflow和博客的文章,这些文章feedparser不能直接在gapp引擎上运行.我遵循了建议并使用了urlfetch.fetch(feed_url)但是我也遇到了错误.

PS:gapp启动器上的PythonPath是 C:\Python25\python.exe

Max*_*xim 5

您已feedparser在本地安装,因此当您在开发服务器上运行应用程序时,它可以工作.但是为了feedparser在生产中使用,您需要将它包含在您的项目中,因为GAE不会为您提供此库.

您需要feedparser与项目文件一起上传.为此,您可以将其复制到应用程序根目录中,然后部署您的应用程序.