Skip to Content
Author's profile photo Former Member

Consuming OData in Python


Python is my favorite programming language, the reason for this blog post is just my curiosity.

There are few ways how to make python work with SAP.

But what about a connection to gateway using OData?

There are documents about connecting to gateway for PHP, Java Script, Flex, .NET, Objective C in SAP NetWeaver Gateway Developer Center. But where is Python?

OData library for python

I started to look for an odata library and found two reasonable options:

  1. OData-py is “OData provider for Google App Engine Datastore”. Unfortunately, it can be probably used only in google app engine, has several limitations, and is not maintained since 2011.
  2. Pyslet is “Python for Standards in Learning Education & Training”. It includes module which implements OData client and also server. Let’s see what it can offer.

Running Pyslet on is a small python framework for creating web applications. Integration was simple – install pyslet, import a module and you are can start consuming an OData service. I created small hello world application that fetches product list and displays product names.


from pyslet.odata2.client import Client

Handling class:

class index:
    def GET(self):
    productNames = []
    for k,p in products.iteritems():
        web.header('Content-Type', 'text/html')
        return render_template('index.html', products = productNames)


<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <title>Python + ODATA</title>
    <table border="1">
     {% for name in products %}
     {% endfor %}

And the result:



I used information from author’s blog – More useful and detail information can be found there.

This was just a simple experiment. Author claims that the module does not work with HTTPS OData service, so basically it cannot be used in real environment.

Next challenge? HTTPS source and more sophisticated application!

Small update: I have been playing around with django at JavaScript Jobs and as a hobby project, I would like to try create odata plugin for django. If is someone willing to help me let me know.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Petr Hanak
      Petr Hanak

      In case that somebody come into an old link - there is pyodata library now for same.


      SAP/python-pyodata: Enterprise-ready Python OData client (

      pyodata ยท PyPI