snappass
snappass copied to clipboard
First working API implementation
This is my attempt at adding an API to SnapPass. I used this implementation about 8 months ago when I needed to generate a lot of SnapPass URLs for a project at my previous employer.
It was previously mentioned by one of the maintainers they wanted to keep apart the web form code and any API code. This doesn't currently do that, but I am interested in discussing the appropriate way to do that.
Now that SnapPass supports multi-line passwords/secrets, I don't know the best way to handle that when POSTing via curl.
I'm working on applying your suggested fixes.
Is there a way to not have the abort() function output HTML?
Is there a way to not have the abort() function output HTML?
Yes, that's where the errorhandler
bit comes in:
@app.errorhandler(404)
def not_found(error):
message = {
'status': error.status_code,
'message': 'Not Found: ' + request.url,
}
return make_response(jsonify(message), error.status_code)
Hey just letting you know this is not dead. I just need to find a little time to review it, probably in the next week or so!
Hey @nichochar, no problem! No rush at all. I haven't had a chance to dive back into this yet.
Any progress on this one?
Any progress on this getting rolled into the main build?
Looking back at this, it looks pretty good. One thing that is missing that I'd love to see is some tests.
I think that with a rebase and some tsts we can pull it in @jameswthorne. Let me know if you're still interested in contributing, we've been a little slow to respond! If not I'll take this over and push it through, since I think an API is a good idea.
Hey @nichochar
It's been sometime since I've looked over the code. I will try and find sometime this week to rebase and review.
Awesome thanks @jameswthorne. Let me know if this is hard for you and I'm happy to commandeer the PR, it's up to you!
I rebased from the latest master and incorporated suggested fixes from @coyotwill.
I still need to incorporate the necessary tests.
How life gets in the way. I'm planning on rebasing from master and writing the tests this month.
Came here looking for an API for SnapPass. Any progress on getting this baked in? Thank you.
Was hoping there would be an update to this, but it seems the PR author has gone silent. Would be great if somebody could pick this back up.