This is the OSDU SDK for Python (work in progress).
Please give your feedback by raising an issue.
Usage requires that you have a valid python 3.8+ installation on your machine. You might also consider creating a seperate python virtual environment for working with OSDU.
For general usage deploying from PyPi is the easiest and recommended method.
pip install osdu-sdk
If you want to modify the sdk code then see the development wiki for alternative setup steps.
- Import necessary items
from osdu.client import OsduClient
from osdu.identity import OsduTokenCredential, OsduMsalInteractiveCredential, OsduEnvironmentCredential
- Create an instance of OsduTokenCredential, OsduMsalInteractiveCredential, OsduEnvironmentCredential or your own custom class.
credential = OsduMsalInteractiveCredential(client_id, authority, scopes, token_cache)
- Create a client
client = OsduClient(server, partition, credential)
- Use the REST interface to call OSDU API's
response = client.get(client.server_url + '/api/search/v2/health/readiness_check')
print(f"Search service: {response.status_code}\t {response.reason}")
For a full example see examples/example.py
We welcome any kind of contribution, whether it be reporting issues or sending pull requests.
When contributing to this repository abide by the Equinor Open Source Code of Conduct.
If your issue is relevant to the OSDU CLI, please use this repositories issue tracker.
Be sure to search for similar previously reported issues prior to creating a new one. In addition, here are some good practices to follow when reporting issues:
- Add a
+1
reaction to existing issues that are affecting you - Include verbose output (
--debug
flag) when reporting unexpected error messages - Include the version of OSDU SDK for Python installed,
pip show osdu
will report this - Include the version of OSDU you are using
See the wiki page on contributing for more information on submitting code changes.