导入urlfetch在Jython Google App Engine上不起作用

问题描述 投票:1回答:1

我在Google App Engine上使用Jython,但无法使“导入urlfetch”正常工作。 其他导入(例如“ import sys”和“ import zlib”)可以工作,但不能“ import urlfetch”。 我收到500服务器错误。 我究竟做错了什么?

我的仪表板日志中的错误消息是:

1) javax.servlet.ServletContext log: debug: Callable object not in cache

2) /java.lang.ExceptionInInitializerError错误

3)嵌套在java.lang.ExceptionInInitializerError:java.security.AccessControlException:access拒绝java.lang.ExceptionInInitializerError:java.security.AccessControlException:access (java.lang.RuntimePermission ModifyThreadGroup)

4)servlet未捕获的异常

java.lang.ExceptionInInitializerError

我还尝试将线程安全设置为false和true,但似乎都没有任何效果(我在某处看到jython和threadsafe = TRUE可能存在问题)。

感谢你给与我的帮助!

google-app-engine jython urlfetch
1个回答
1
投票

你有没有尝试过:

from google.appengine.api import urlfetch

从此:

您可以使用Python标准库urllib,urllib2或httplib发出HTTP请求。 在App Engine中运行时,这些库使用App Engine的URL提取服务执行HTTP请求,该服务在Google的可扩展HTTP请求基础结构上运行。

我读到它不是GAE中使用的“正常” urlfetch。

https://developers.google.com/appengine/docs/python/urlfetch/overview

© www.soinside.com 2019 - 2024. All rights reserved.