Establishing a Connection
The objects available within our connector are accessible from the "cdata.odata" module. In order to use the module's objects directly, the module must first be imported as below:
import cdata.odata as mod
From there, the connect() method can be called from the connector object to establish a connection using an appropriate connection string, such as the below:
Connecting to OData
To connect, you need to set the Url to a valid OData service root URI in addition to the authentication values.
Also, you can specify a CacheLocation to store the metadata of your OData organization. This keeps the CData Python Connector for OData from having to send requests for metadata on each connection.
Authenticating to OData
The provider supports the major authentication schemes, including HTTP and Windows.
Set AuthScheme to use the following authentication types.
- HTTP Authentication: The provider supports authentication with HTTP Basic, Digest, and custom headers. To use Basic or Digest, set the User and Password. You can specify other authentication values in CustomHeaders.
- Windows (NTLM): Set the Windows User and Password to connect and set AuthScheme to "NTLM".
- Kerberos and Kerberos Delegation: To authenticate with Kerberos, set AuthScheme to NEGOTIATE. To use Kerberos Delegation, set AuthScheme to KERBEROSDELEGATION. If needed, provide the User, Password, and KerberosSPN. By default, the provider attempts to communicate with the SPN at the specified Url.
Securing OData Connections
By default, the provider attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats to do so.