【发布时间】:2021-04-29 05:18:15
【问题描述】:
在下面发布的代码中,featuresArray 是一个特征数组。我希望下面发布的 web 服务返回代码中所述的“featuresArray”。当运行我收到的应用程序时
internal server error
但是,例如,当我返回时
feature[0] or specify the index
网络服务显示该值。
那么我怎样才能让网络服务返回并显示对象freaturesArray
python 代码:
@app.route("/geodata/<string:polygonCoordinates>", methods=['GET'] )
def geodata(polygonCoordinates):
...
...
url = url.replace(" ","%20")
backendResponseAsJSON = readResponseAsJSONForURL(url)
geojsonObjectAsJSON = loadDataAsJSON(backendResponseAsJSON['geojson'][0])
featuresArray = geojsonObjectAsJSON['features']
for feature in featuresArray:
pass#print (feature)
#baseURL = config['EndPoint']['https'] + config['EndPoint']['url'] + config['EndPoint']['api_key'] + config['EndPoint']['start'] + polygonCoordinates + "," + polygonCoordinates + config['EndPoint']['end'] + polygonCoordinates + "," + polygonCoordinates
#print("baseURL: %s"%(baseURL))
return featuresArray
【问题讨论】:
标签: python json web-services flask flask-restful