是否提供OData Python库?

2024-05-16 01:22:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我想知道是否有OData Python库可用于生成和使用OData? 有针对不同语言的实现: http://www.odata.org/libraries/

但到目前为止我还没找到Python。我不是说铁蟒。这个库应该只在Python中可用。


Tags: org语言httplibrarieswwwodata
3条回答

我是http://code.google.com/p/odata-py/图书馆的作者 它仍处于早期阶段,但它提供了最基本的功能(创建、读取、更新)。如果您看到一个bug或想要贡献,请毫不犹豫地留言;)

不久前,我开始了自己的OData 4.0消费者项目。它基于requests库,是纯Python。这是相当少的,因为我只实现了我需要的工作。看看我的github

有点像这样:

from odata import ODataService
url = 'http://services.odata.org/V4/Northwind/Northwind.svc/'
Service = ODataService(url, reflect_entities=True)
Product = Service.entities['Product']

query = Service.query(Product)
query = query.filter(Product.ProductName.startswith('Queso'))
query = query.order_by(Product.UnitPrice.desc())
for product in query:
    print(product.ProductName)

我最近在为一个名为Pyslet的e-Learning项目维护的Python包中添加了一些OData模块。该项目托管在Github上,地址是:https://github.com/swl10/pyslet

我在这里写了一篇介绍OData消费者特性的博客文章:http://swl10.blogspot.co.uk/2014/02/a-dictionary-like-python-interface-for.html

相关问题 更多 >