是否可以在 Google App Engine 上使用 Python lxml?

发布于 2024-08-15 10:40:25 字数 148 浏览 3 评论 0原文

我可以在 Google App Engine 上使用 Python lxml 吗? (或者我必须使用 Beautiful Soup 吗?)

我已经开始使用 Beautiful Soup 但看起来很慢。我刚刚开始尝试从其他网站“屏幕抓取”数据来创建某种“混搭”的想法。

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".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我为君王 2024-08-22 10:40:25

编辑lxml现已支持


简短回答:您不能

来自 AppEngine 的文档:
“为Python环境编写的应用程序代码必须完全用Python编写。不支持用C语言编写的扩展”

现在您是否必须使用BeautifulSoup,这实际上取决于您打算如何使用它。请用详细信息更新问题,如果可能的话,我将尝试在此处更新其他建议。

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.

缪败 2024-08-22 10:40:25

要添加到 Caio 的修订答案,您可以使用 lxml ,具体操作方法如下:

app.yaml 文件中,添加以下内容:

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

现在 import lxml 将在您的 Python 脚本中运行。

以下是官方文档的链接。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文