52

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.

swl10
  • 323
  • 2
  • 6
Patrick Wolf
  • 2,530
  • 2
  • 28
  • 27

6 Answers6

16

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 ;)

andri
  • 1,010
  • 1
  • 9
  • 12
  • 11
    After a brief scrollthrough of the source code, `odata-py` seems to only work with Google App Engine. Do you plan to move away from that dependency at some point in time? – joar Dec 08 '11 at 16:20
7

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

swl10
  • 323
  • 2
  • 6
7

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)
tuomur
  • 6,888
  • 34
  • 37
2

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

dowski
  • 3,188
  • 2
  • 20
  • 16
1

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

1

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.

Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
  • 2016 meanwhile and none did emerge, rite? – Red Pill Jul 01 '16 at 09:18
  • ty, will check it out, I'm back to 2.7. Sort of sad: "Once Pyslet works under Python 3 I will start work on updating the existing OData package to support OData versions 3 and 4." – Red Pill Jul 24 '16 at 09:41