Is it possible to use Python lxml on Google App Engine?

我与影子孤独终老i 提交于 2019-12-13 11:59:48

问题


Can I use Python lxml on Google App Engine? (or do I have to use Beautiful Soup?)

I have started using Beautiful Soup but it seems slow. I am just starting to play with the idea of "screen scraping" data from other websites to create some sort of "mash-up".


回答1:


EDIT: The lxml library is now supported.


Short answer: you can't.

From AppEngine's docs: "Application code written for the Python environment must be written exclusively in Python. Extensions written in the C language are not supported"

Now whether you must use BeautifulSoup or not, it really depends on how you plan to use it. Update the question with details and I'll try to update here with other suggestions, if possible.




回答2:


To add to Caio's revised answer, you can use lxml and this is how to do it:

In your app.yaml file, add the following:

libraries:
- name: lxml
  version: "2.3"   # or "latest"

Now import lxml will work in your Python script.

Here is the link to the official documentation.



来源:https://stackoverflow.com/questions/1894696/is-it-possible-to-use-python-lxml-on-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!