tuomur / python-odata

A simple library for read/write access to OData services
MIT License
79 stars 60 forks source link

Update README to include how to use it with Dynamics 2016 #5

Closed awartani closed 7 years ago

awartani commented 8 years ago

I came to this while trying to integrate it with Microsoft Dynamics 2016 and couldn't figure how to connect to it, because ODataService had auth param it was easy to integrate Dynamics authentication with it, simply use HttpNtlmAuth.

import requests

auth_username = ''
auth_password = ''
basic_url = ''
odata_url = ''

session = requests.Session()
session.auth = HttpNtlmAuth(auth_username, auth_password, session)
session.get(basic_url) # should return 200

service = ODataService(odata_url, reflect_entities=True, session=session)

We noticed that after HttpNtlmAuth request, it was redirected to /adfs/ls page to perform wsignin1 request. I don't know much about Dynamics nor Microsoft standers but I am happy to share the code if somebody needs it.

tuomur commented 7 years ago

Added this example to the docs. Thanks :)