Giter Site home page Giter Site logo

sample-adh-assets-python's Introduction

CONNECT data services Assets Python Sample

Version: 1.1.6

Build Status

Developed against Python 3.9.1.

Requirements

  • Python 3.7+
  • Register a Client-Credentials Client in your CONNECT data services tenant and create a client secret to use in the configuration of this sample. (Video Walkthrough)
  • Install required modules: pip install -r requirements.txt

About this sample

This sample uses REST API calls to work with assets and asset types in ADH. It follows a set of steps to demonstrate the usage of various asset endpoints. The assets API reference documentation can be found here.

  1. Obtain an OAuth token for ADH, using a client-credentials client
  2. Create an SDS type
  3. Create an SDS stream
  4. Insert data into the stream
  5. Create an ADH asset
  6. Create an ADH asset type
  7. Create an asset from an asset type
  8. Retrieve an asset
  9. Retrieve a resolved asset
  10. Update an asset
  11. Retrieve the updated asset
  12. Retrieve data from an asset
  13. Retrieve status for an asset
  14. Search for an asset by asset type id
  15. Clean up assets, asset types, stream, and type

Configuring the sample

The sample is configured using the file appsettings.placeholder.json. Before editing, rename this file to appsettings.json. This repository's .gitignore rules should prevent the file from ever being checked in to any fork or branch, to ensure credentials are not compromised.

CONNECT data services is secured by obtaining tokens from its identity endpoint. Client credentials clients provide a client application identifier and an associated secret (or key) that are authenticated against the token endpoint. You must replace the placeholders in your appsettings.json file with the authentication-related values from your tenant and a client-credentials client created in your ADH tenant.

{
  "Resource": "https://uswe.datahub.connect.aveva.com",
  "ApiVersion": "v1",
  "TenantId": "PLACEHOLDER_REPLACE_WITH_TENANT_ID",
  "NamespaceId": "PLACEHOLDER_REPLACE_WITH_NAMESPACE_ID",
  "ClientId": "PLACEHOLDER_REPLACE_WITH_APPLICATION_IDENTIFIER",
  "ClientSecret": "PLACEHOLDER_REPLACE_WITH_APPLICATION_SECRET"
}

Running the sample

To run this example from the command line once the appsettings.json is configured, run

python program.py

Running the automated test

To test the sample, run

pip install pytest
python -m pytest test.py

Tested against Python 3.9.1
For the ADH Assets samples page ReadMe
For the main ADH samples page ReadMe
For the main AVEVA samples page ReadMe

sample-adh-assets-python's People

Contributors

cbardini avatar anton-dahlin avatar derekendres avatar dcbroad3 avatar

Watchers

James Cloos avatar John Sintilas avatar Thomas Ng avatar  avatar Brandon Perry avatar Ben Simpson avatar  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.