Git Product home page Git Product logo

toopher-python's People

Contributors

dshafer avatar egrim avatar mtw17 avatar mwham avatar smholloway avatar trdarr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

toopher-python's Issues

ToopherIframe.validate mutates the data parameter, which might be immutable

In Flask, the request data is an ImmutableMultiDict, so the ToopherIframe.validate method will throw an error when trying to delete the Toopher signature.

Here's how I called validate:

validated_data = api.validate(request.args, request_token)

And this is the line that threw the error:

del data['toopher_sig']

I suggest we make a mutable copy of the data that we can manipulate and return. There's probably a cleaner way to do it, but this is how I got around it in my example:

mutable_dict = {}
for key in data.keys():
    mutable_dict[key] = data[key]

{Pairing, Authentication}Status.__getattr__ raises KeyError instead of AttributeError

We use __getattr__ to make accessing the response data nicer, so __getattr__(self, name) returns self._raw_data[name]. However, if name isn’t in _raw_data, a KeyError will be raised. I think most Python programmers would expect an AttributeError. We should probably also support nested attributes, because auth_request.requester.id is way less pretty than auth_request.requester['id'].

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.