尝试使用Flask开发Python应用程序,使用OData服务连接到saphana。当尝试打开url时,整个应用程序崩溃,我得到一个DeprecationWarning。弃用警告的目的是什么?你知道吗
from flask import Flask, render_template, request
from pyslet.odata2.client import Client
from pyslet.http.auth import BasicCredentials
from pyslet.http.client import Client as http
from pyslet.http.client import ClientRequest
app = Flask(__name__)
@app.route('/')
def test():
return('test')
@app.route('/odata')
def hello():
table = testClient()
return render_template('odata.html', table=table)
def testClient():
c = MyAuthenticatedClient('link to xso data')
table = c.feeds['MarketShareFSet'].OpenCollection()
tablenames = []
for t in table.iteritems():
c1 = p['ID'].value
c2 = p['Country'].value
c3 = p['Hub'].value
c4 = p['Division'].value
tablenames.append((c1, c2,c3,c4))
return tablenames
127.0.0.1 - - [13/Mar/2019 13:59:40] "GET / HTTP/1.1" 200 -
main.py:23: DeprecationWarning: EntitySet.OpenCollection is deprecated, use open instead
table = c.feeds['MarketShareFSet'].OpenCollection()
来自维基百科:
它警告您,
OpenCollection()
方法现在不是最好的使用方法(无论出于什么原因),而最佳实践是使用open()
方法。你知道吗通常在软件中,东西会贬值,然后,以后,就不再支持或从更高版本的版本中删除。你知道吗
相关问题 更多 >
编程相关推荐