mohawk
mohawk copied to clipboard
Add a high level bewit interface and docs
I think we need a higher level interface for bewit (signed URLs) and some good docs. I can work on this. The core functions were added in https://github.com/kumar303/mohawk/pull/13
@edmorley btw, I pushed the undocumented bewit support to PyPI so you can use it more easily. http://mohawk.readthedocs.org/en/latest/#changelog
@edmorley btw, I pushed the undocumented bewit support to PyPI so you can use it more easily. http://mohawk.readthedocs.org/en/latest/#changelog
Thank you :-)
CC @catlee @jhford
Thanks again for implementing bewit!
I documented the low level interface https://mohawk.readthedocs.io/en/latest/usage.html#generating-protected-urls
I still think the interface is a bit awkward so I'll leave this issue open. Here are ideas for improvement:
- The caller shouldn't need to craft a
Resource
object with an empty nonce. - A higher level function should also accept an expiration time in seconds rather than require a complete timestamp.
- The higher level function could also generate the final URL itself.
- All exceptions should derive from
HawkFail
, see https://github.com/kumar303/mohawk/issues/54 - I'd rather see
check_bewit
fail only by raising an exception, instead of returning booleans. That would make the calling code easier.