Git Product home page Git Product logo

sdk-utilities-python's Introduction

FINBOURNE® SDK Utilities

LUSID_by_Finbourne

Daily build Build and test

This package provides a set of utilities for use with the suite of FINBOURNE Python SDKs, this includes capabilities such as:

  • authentication token acquisition
  • refresh token
  • request retries
  • API construction

Installation

The SDK utilities package is available on PyPi and can be installed using the following:

pip install finbourne-sdk-utilities

SDK Configuration

The following configuration items are used by the utilities package to configure the SDK:

Key Description
apiUrl The API url
tokenUrl Okta endpoint to generate the authentication token, this is the value for 'Token Url' in your portal
clientId OpenID Connect Client ID, this is the value for 'Client Id' in your portal
clientSecret OpenID Connect Client Secret, this is the value for 'Secret' in your portal
username The username of the account being used for accessing the API
password The password of the account being used for accessing the API
applicationName An optional identifier for your application

These configuration items must be exposed by an SDK via a utilities module containing a ConfigKeys class with get() classmethod that returns a dictionary of configuration keys/values.

mysdk/
|
...
├── utilities/
│   ├── __init__.py
│   └── ConfigKeys.py
...

An implementation of ConfigKeys.py may look like the example below where the keys are stored in a json file

class ConfigKeys:

    config_key_path = 'config_keys.json'

    @classmethod
    def get(cls):
        with open(Path(__file__).parent.joinpath(cls.config_key_path)) as json_file:
            config_keys = json.load(json_file)

        return config_keys

The returned values are a dictionary of configuration keys, containing a dictionary of key-values for the environment variables and json configuration files e.g.

{
    ...

    "token_url": {  
        "env": "FBN_TOKEN_URL",
        "config": "tokenUrl"
    },

    ...
}

Usage

The SDK utilities can be used with FINBOURNE SDKs such as the Luminesce Python SDK

import luminesce
from fbnsdkutilities import ApiClientFactory

factory = ApiClientFactory(luminesce)
sql_exec_api = factory.build(luminesce.api.SqlExecutionApi)

sql_exec_api.put_by_query_csv("""
    select * from lusid.portfolio limit 10
""")

sdk-utilities-python's People

Contributors

mneedham avatar matthew-boardman avatar mikemcgarry avatar pms1969 avatar

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.