pyodata

1.11.2 · active · verified Thu Apr 16

pyodata is an enterprise-ready Python OData client that provides a comfortable and Python-agnostic way to communicate with OData services. It abstracts away OData protocol implementation details, primarily supporting OData V2, with future plans for V4 support. The library is actively maintained, with frequent minor releases, and its current version is 1.11.2.

Common errors

Warnings

Install

Imports

Quickstart

Initializes an OData client using `requests.Session` and queries the 'Products' entity set from the Northwind OData V2 sample service. This demonstrates basic client setup and data retrieval.

import requests
import pyodata
import os

# Replace with your OData service URL
SERVICE_URL = os.environ.get('PYODATA_SERVICE_URL', 'http://services.odata.org/V2/Northwind/Northwind.svc/')

session = requests.Session()

# For services requiring authentication
# username = os.environ.get('PYODATA_USERNAME', '')
# password = os.environ.get('PYODATA_PASSWORD', '')
# if username and password:
#     session.auth = (username, password)

# Create instance of OData client
client = pyodata.Client(SERVICE_URL, session)

# Example: Query all products
products_request = client.entity_sets.Products.get_entities()
products = products_request.execute()

print(f"Found {len(products)} products:")
for product in products[:3]: # Print first 3 products
    print(f"- {product.ProductName} (ID: {product.ProductID})")

view raw JSON →