{"id":9230,"library":"pyodata","title":"pyodata","description":"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.","status":"active","version":"1.11.2","language":"python","source_language":"en","source_url":"https://github.com/SAP/python-pyodata","tags":["OData","SAP","client","REST","data-access","enterprise"],"install":[{"cmd":"pip install -U pyodata","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"PyOData requires an external HTTP library with an API compatible with `requests.Session` for all HTTP communication.","package":"requests","optional":false}],"imports":[{"note":"The primary entry point for interacting with an OData service.","symbol":"Client","correct":"import pyodata\n# ...\nclient = pyodata.Client(...)"},{"note":"Used for advanced filtering of entity sets in a more Pythonic/ORM-like style.","symbol":"GetEntitySetFilter","correct":"from pyodata.v2.service import GetEntitySetFilter as esf"},{"note":"Base exception for HTTP errors (status codes >= 400) returned by the OData service.","symbol":"HttpError","correct":"from pyodata.exceptions import HttpError"}],"quickstart":{"code":"import requests\nimport pyodata\nimport os\n\n# Replace with your OData service URL\nSERVICE_URL = os.environ.get('PYODATA_SERVICE_URL', 'http://services.odata.org/V2/Northwind/Northwind.svc/')\n\nsession = requests.Session()\n\n# For services requiring authentication\n# username = os.environ.get('PYODATA_USERNAME', '')\n# password = os.environ.get('PYODATA_PASSWORD', '')\n# if username and password:\n#     session.auth = (username, password)\n\n# Create instance of OData client\nclient = pyodata.Client(SERVICE_URL, session)\n\n# Example: Query all products\nproducts_request = client.entity_sets.Products.get_entities()\nproducts = products_request.execute()\n\nprint(f\"Found {len(products)} products:\")\nfor product in products[:3]: # Print first 3 products\n    print(f\"- {product.ProductName} (ID: {product.ProductID})\")\n","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.7 and 3.8 are no longer supported. The library now requires Python >= 3.9.","severity":"breaking","affected_versions":">=1.11.0"},{"fix":"Before making a POST/PATCH request, execute a HEAD request to the service URL to obtain the 'x-csrf-token' and 'set-cookie' headers, then include them in subsequent requests. Example: `session.head(SERVICE_URL, headers={'x-csrf-token': 'fetch'})`.","message":"When creating or updating entities (POST/PATCH requests), OData services often require CSRF tokens. You must correctly initialize your `requests.Session` to handle these, typically by fetching a token with a HEAD request first.","severity":"gotcha","affected_versions":"All"},{"fix":"Configure the metadata parser to recover from problems using `pyodata.Client`'s `config` parameter. You can specify parser policies (e.g., `PolicyWarning`, `PolicyIgnore`) and set `retain_null=False` to prevent substitution by default values.","message":"The metadata parser can encounter errors with non-fully valid metadata documents. This can lead to issues if the service is not under your control. By default, missing properties might be filled with type-specific default values.","severity":"gotcha","affected_versions":"All"},{"fix":"Use the `config` object (e.g., `pyodata.client.config`) to manage XML namespaces and other parser settings instead.","message":"Directly setting custom XML namespaces via the client initialization is deprecated.","severity":"deprecated","affected_versions":"<=1.x"},{"fix":"Use the `.custom(name, value)` method on entity requests to add custom query parameters. To disable URL path encoding, set `encode_path=False` during client initialization or on the request.","message":"OData services may require non-standard URL query parameters (e.g., 'sap-client') or specific path encoding. The default behavior might not always match specific service implementations.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'1.11.2':56 'abstract':26 'access':63 'activ':45 'agnost':18 'away':27 'client':10,59 'comfort':14 'communic':21 'current':53 'data':62 'data-access':61 'detail':31 'enterpris':6,64 'enterprise-readi':5 'frequent':48 'futur':37 'implement':30 'librari':43 'maintain':46 'minor':49 'odata':9,23,28,34,57 'plan':38 'primarili':32 'protocol':29 'provid':12 'pyodata':1,2 'python':8,17 'python-agnost':16 'readi':7 'releas':50 'rest':60 'sap':58 'servic':24 'support':33,41 'v2':35 'v4':40 'version':54 'way':19","created_at":"2026-04-16T18:49:08.518117+00:00","updated_at":"2026-04-16T18:49:08.518117+00:00","problems":{"verify_error":"error: unexpected argument '- ' found\n\n  tip: to pass '- ' as a value, use '-- - '\n\nUsage: uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDITABLE>|--group <GROUP>>\n\nFor more information, try '--help'."},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.11.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/SAP/python-pyodata","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pyodata/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}