kumar303 / mohawk

Python library for Hawk HTTP authorization
BSD 3-Clause "New" or "Revised" License
47 stars 20 forks source link

Please remove the `if not isinstance(creds, dict):`check #21

Closed klahnakoski closed 8 years ago

klahnakoski commented 8 years ago

It is interfering with other Mapping instances that I send to it.

kumar303 commented 8 years ago

I'm not sure what you're referring to. Could you add a link to the code? Could you provide an example of how you're calling the function?

klahnakoski commented 8 years ago

The offending line is [1]. This is how I am calling:

        receiver = Receiver(
            lookup_credentials,
            auth,
            request.url,
            request.method,
            content=request.data,
            content_type=request.headers['Content-Type'],
            seen_nonce=seen_nonce
        )

where lookup_credentials is returning a Mapping [2]. Mapping is a more general version of a dict. Maybe just getting rid of the type check is fine, since you are verifying the properties exist already.

[1] https://github.com/kumar303/mohawk/blob/42103d69edfeb2e956ad03d266e0e0c856b9f3e4/mohawk/util.py#L28 [2] https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping

kumar303 commented 8 years ago

Sorry about that, should be fixed on master now.