50
votes

I was wondering if any OData Python libraries are available to produce and consume OData? There are implementations for different languages: http://www.odata.org/libraries/

But I couldn't find Python so far. I don't mean IronPython by the way. The library should be just usable in Python.

7
I would be interesting in finding a library for this as well - Joel Martinez
Why bounty this when it has already been answered? Placing a bounty on your question doesn't make an imaginary library materialize and bite you on the foot :) - Jeff LaFay

7 Answers

16
votes

i am the author of the library at http://code.google.com/p/odata-py/ it's still in its early stages but it provides the most basic functionalities (create, read, update). Don't hesitate to drop a message if you see a bug or want to contribute ;)

7
votes

I started my own OData 4.0 consumer project some time ago. It's based on the requests library and is pure Python. It's rather minimal as I've only implemented things I needed for work. Check it out on my github.

Works kinda like this:

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)
6
votes

I've recently added some OData modules to a Python package I maintain for an e-Learning project called Pyslet. The project is hosted on Github here: https://github.com/swl10/pyslet

I wrote an introductory blog post demonstrating the OData consumer features here: http://swl10.blogspot.co.uk/2014/02/a-dictionary-like-python-interface-for.html

2
votes

I also wanted to know this so I send them an e-mail. In response they referred to their faq which states:

Q: Is there a client library to consume an OData feed available for my

platform?

A: OData client libraries are available for a range of platforms including .NET and Silverlight through WCF Data Services, as well as AJAX, PHP, Java and the IPhone.

So, the answer is: no :-(

2
votes

Here is a version that is targeting Google App Engine: http://code.google.com/p/odata-py/

I've been experimenting with the spec and wrote a simple server for Python called MyOhData: https://bitbucket.org/dowski/myohdata/src

1
votes

I've looked as well after getting an intro to OData and it looks like there isn't one as of yet unfortunately. I'll be keeping an eye out for one as I'm sure one will surface.

Update 2016

OData Libraries lists two python libraries that support OData. With pyslet looking to be the most active since it has had commits in the last few months and several releases. I haven't tried either of them so I can't really say if they work well or not.

0
votes

please check this link

http://www.odata.org/libraries/

ODataPy (Python)
ODataPy is an open-source Python library that implements the Open Data Protocol (OData). It supports the OData protocol version 4.0. It is built on top of ODataCpp using language binding. It is under development and currently serves only parts of client and client side proxy generation (code gen) aspects of OData.

V4 Client GitHub ODataStore for CoreData (iOS)
The ODataStore for CoreData is an iOS static library and a Mac OS X Framework to use V3 OData services with the CoreData Framework from Apple. V4 OData services will be supported in the future. The development language is Objective-C.

V3 Both Link Pyslet Python Package (Python)
Pyslet is a Python package for Standards in Learning Education and Training. It implements a number of standards including OData v2 with both client and server capabilities.

V2 Both Link OData4ObjC
This library makes it easy for iOS app developers to interact with data in any OData-compliant web service. It supports metadata-aware client-side code generation and full CRUD with query. If someone exposes a data model via OData, OData4ObjC makes it easy to get that model onto your iOS device.

V1-3 Client GitHub