所以我不太确定这个问题。。。基本上,只要我使用正在使用的liveapi来获取数据,一切都正常。但是,如果我试图打开一个包含相同数据的现有文件(来自上一个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执行脚本。你知道吗
这是一件无关的事。基本上,这是失败的,因为。。。所以在第一个调用中,它细化了我从API返回的数据,然后将细化后的数据存储在json文件中。你知道吗
所以在下一次加载时,json文件存在,当它加载它时,一些东西在细化过程中被重命名了,所以脚本的其余部分不知道如何执行。愚蠢的问题。你知道吗
相关问题 更多 >
编程相关推荐