【发布时间】:2015-05-18 22:05:55
【问题描述】:
所以我不太确定这里的问题...基本上,只要我使用我正在使用的实时 API 来获取数据,一切正常。但是,如果我尝试打开其中包含相同确切数据的现有文件(来自先前的 api 调用),我会收到内部服务器错误。这是导致问题的代码块:
thisFile = os.path.join(__location__, '2014/' + npi + '_individual.json')
# if the local cached copy exists, then load that, otherwise, connect to the API
if os.path.isfile(thisFile):
target2 = open(thisFile)
content = json.loads(target2.read())
else:
req = urllib2.Request(url + '?database=nppes&npi=' + npi + '&apikey=' + apiKey)
r = urllib2.urlopen(req)
content = json.loads(r.read())
我相信我正在使用 webpy 或 web2py(我不确定它们是否是两个独立的东西)。在 Apache2.4 上通过 WSGI 执行脚本。
【问题讨论】: