Giter Site home page Giter Site logo

osdu-sdk-python's Introduction

OSDU SDK for Python

Build License PyPi Version PyPI - Python Version Unknown coverage

This is the OSDU SDK for Python (work in progress).

โš ๏ธ Note that this is a work in progress and is not complete / might contain bugs and might be subject to breaking changes.

Please give your feedback by raising an issue.

Installation

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.

Usage

  1. Import necessary items
from osdu.client import OsduClient
from osdu.identity import OsduTokenCredential, OsduMsalInteractiveCredential, OsduEnvironmentCredential
  1. Create an instance of OsduTokenCredential, OsduMsalInteractiveCredential, OsduEnvironmentCredential or your own custom class.
credential = OsduMsalInteractiveCredential(client_id, authority, scopes, token_cache)
  1. Create a client
client = OsduClient(server, partition, credential)
  1. 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

Contributing

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.

CLI specific issues and requests

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

Code changes

See the wiki page on contributing for more information on submitting code changes.

osdu-sdk-python's People

Contributors

janmortensen avatar javeriahabib09 avatar john-haugland avatar mahewitt avatar snyk-bot avatar tahir-so avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

osdu-sdk-python's Issues

Better error message in error handling or at least logging in post_returning_json and get_returning_json

When (client.py ) post_returning_json (and get_returing_json and put_returning.json) is called without param ok_status_codes
only the response code 200 is added as status code that is ok before calling self.post. But when another status code than 200 is returned, the error message is " HTTPError(response=response)" which doesn't provide enough information.
It's is necessary to dot into the response proprty of the exception to find the response code. Is it possible to have the error code in the str representation of the HttpError?

'osdu' is not a package

Getting an error when trying to import OsduClient

from osdu.client import OsduClient

produces this error:
ModuleNotFoundError: No module named 'osdu.client'; 'osdu' is not a package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.