GithubHelp home page GithubHelp logo

traversys / tideway Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 0.0 114 KB

Python library for BMC Discovery API Interface.

License: GNU General Public License v3.0

Python 100.00%
bmc discovery tideway requests api-wrapper

tideway's Introduction

Tideway

Simplified Python library for BMC Discovery API Interface that makes use of the Python Requests module https://github.com/psf/requests and uses the same response handler.

>>> import tideway
>>> tw = tideway.appliance('appliance-hostname','auth-token')
>>> tw.about().url
'https://appliance-hostname/api/about'
>>> tw.about().status_code
200
>>> tw.about().text
{
    "api_versions": [
        "1.0",
        "1.1",
        "1.2",
        "1.3",
        "1.4",
        "1.5"
    ],
    "component": "REST API",
    "product": "BMC Discovery",
    "version": "12.5"
}

Tideway follows BMC Discovery's well-structured and documented REST API which can be viewed from https://<appliance>/swagger-ui/.

Tideway removes the extra layer of manually constructing a URL and parameters for python requests allowing you to query API supported features of Discovery seamlessly and faster than if you were to navigate via the GUI.

Documentation

Documentation can be found at https://traversys.github.io/Tideway/.

Releases

Version Summary Known Issues Fixed
0.1.1 - Updated to API v1.2
- Added help(), search_bulk()
search call retains last parameters for offset, results_id
0.1.2 Bug Fixes Bulk search with larger limit than dataset will fail on missing next_offset - Fixed issue with offset and results_id values
- Fixed issue with bulk search parameter lower limit.
0.1.3 Bug Fixes Added check for next_offset.
0.1.4 Search bulk update Discovery 12.3 (21.3) enforces strict case for "Bearer" header - api calls will not current work. Now includes headers for non-formatted search.
0.1.5 Updated to support Discovery 12.3 (API version 1.3) - Missing 'complete' parameter option on graphNode() function. - Fixed issue with Bearer capitalisation.
- Search Bulk will now return the full response on failure
0.2.0 Updated to include Kerberos, Models and Taxonomy endpoints.

Added new high level generic endpoint function calls

Refactored function names/decorators to match API endpoints as close as possible.

Supports Discovery 22.2 (12.5) (API version 1.5) and Outpost API version 1.0
Project missing tkinter module: #15 Added 'complete' parameter to get_data_nodes_graph() (replaces graphNode())

tideway's People

Contributors

codefitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tideway's Issues

ModuleNotFoundError: No module named '_tkinter'

Bug Summary

The module cannot be imported if the tkinter module is not installed in Python.

Module version

v0.2.0

Platform version

  • Python 3.7.3
  • RHEL 7

Steps to reproduce

  • install the 0.2.0 version
    pip install tideway==0.2.0
  • import the module in your code :
       #!/usr/bin/env python3
       # coding: utf-8
       import os
       import sys
       from pathlib import Path
       import argparse
       import json
       import tideway

Actual results

The following error message appears with running the code :

    import tideway
  File "/venv/lib/python3.7/site-packages/tideway-0.2.0-py3.7.egg/tideway/__init__.py", line 4, in <module>
    from tideway import main, \
  File "/venv/lib/python3.7/site-packages/tideway-0.2.0-py3.7.egg/tideway/main.py", line 4, in <module>
    from tkinter import BASELINE
  File "/usr/local/lib/python3.7/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

Additional information

tkinter is imported in main.py as follows :

from tkinter import BASELINE

Code refactor to reduce function duplication

A number of functions are duplicated (due to BMC's downstream API changes and my own laziness), these should be cleaned up.

  • Add deprecation warnings
  • Use name bindings for the new functions

Applies to v0.2.0 (currently dev branch)

API calls won't work on API v1.3

The newest release of Discovery (12.3/21.3) Uses API version 1.3.

API calls won't work because the header bearer pre-text is now case sensitive, whereas lowercase was accepted before.

Example: Bearer NDpkaXNjb3B==

Fix needs to be applied to tideway/discoRequests.py line 8

def url_and_headers(target,token,api_endpoint,response):
    url = target + api_endpoint
    headers = {"Accept": response, "Authorization":"bearer " + str(token) }
    return url, headers

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.