GithubHelp home page GithubHelp logo

tessitura-tools's Introduction

Tessitura

Tools for talking to the Tessitura API from Python. This is all just wet paint at the moment.

Requires Python 3.6+

To install just do:

$ pip install tessitura

To use see the following example:

import tessitura
import pprint

endpoint = "https://your.tessitura-endpoint.org/TessituraService/"
credentials = "username:group:location:password"

# The REST API method you wish to call. This may need to be created with other information depending on the request, such as a session id -- See Tessitura documentation for more information. Please note there should be no trailing slash at the end.

method = "Diagnostics/Status"

# The type of request you wish to make. Currently supports GET and POST.

request_type = "GET"

# Use this to add any query string parameters to a GET request
params = {}

# Use this to add any form data to a POST request
data = {}

# Call the API
rsp = tessitura.rest_call(endpoint, credentials, request_type, method, params=params, data=data, timeout=10)

# Print out the results in JSON format
pprint.pprint(rsp)

tessitura-tools's People

Contributors

micahwalter avatar tgb417 avatar

Stargazers

 avatar Marcus Johnson avatar ryan avatar  avatar Elvis Morales avatar Chris Larabee avatar Daniel Pett avatar

Watchers

 avatar James Cloos avatar Chris Larabee avatar

tessitura-tools's Issues

Better error messages.

Currently error messages show the error code from the "reason" statement, which is not as useful as it could be. Consider adding the message from the Tessitura API when possible.

Adding docstrings to public method

One of the nice enhancements we could make to this would be to add docstring type comments. This could make using this library a whole lot easier in a modern python IDE like VS Code and Jupyter Notebooks that use these for
help(tessitura)
and the like.

Add convenience methods

Methods would make it easier to request certain endpoints without needing to select GET or POST for example. Would also offer help text.

Different number of columns for timeouts and Tessitura Submitted errors.

Micah,

Hope you are well.

As I've been using the library. I've been running into a little bit of a challenge when looking at errors.
If one has a time out we get 2 "columns" of data returned by the Tessitura Library. If we get a tessitura derived error we end up with 3 "columns" of data. I'm wondering if for consistency e should be called info rather than e.

Thoughts?

Here is the section of the code I'm looking at

except Exception as e:
    
    timeout = {
        "error": 500,
        "message": "Time Out Error connecting to Tessitura",
        "e": e
    }

    return timeout
    
if r.status_code != 200:
    j = {
        "error": r.status_code,
        "message": r.reason,
    }

    if r.text:
        j["info"] = r.json()

Raise exceptions

I'm considering adding exceptions in favor of returning json with error codes. This would mean the developer using the package would have to handle the exceptions, but it feels like it would be a more consistent approach for a Python SDK.

Please let me know what you think. @tgb417

Allow for variable TimeOut Periods

For Website use, 15 seconds seems like a reasonable time out period. However, for data science data transfer it might be useful to allow longer time out periods. Could we / should we move this to an optional variable with a default built into the code if not otherwise specified?

Thoughts?

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.