Skip to content

rosscdh/django-snowshoestamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-snowshoestamp

A Django app for integrating with snowshoestamp

Installation

  1. python setup.py
  2. pip install requirements.txt
  3. add snowshoestamp to INSTALLED_APPS
  4. add url to sss endpoint
  5. register url with snowsheostamp as webhook callback

Settings

Required

SNOWSHOESTAMP_KEY : the oauth key for your app
SNOWSHOESTAMP_SECRET : the oauth secret for your app

Example Implementation

  1. Setup your urls.py to use the view below as the callback reciever or just use the default sss reciever
  2. Register the url "https://yourhost.com/sss/webhook/" as the webhook callback at snowshoestamp
  3. and that is it, you can now hook up the signal listener and get a signal event whenever a webhook event happens
url(r'^sss/', include('snowshoestamp.urls', namespace='snowshoestamp')),

Or

You can write a custom view, by extending our View and doing somethign more specific with the data, and hook the view up to a url and register that url with snowshoestamp.

from snowshoestamp.views import SnowshoeStampView


class MySnowshoestampWebhookRecieverView(SnowshoeStampView):
    def post(self, request, *args, **kwargs):
        print(self.stamp_serial)
        print(self.stamp_data)

        # do something amazing

        return self.render_json_response({
            'detail': 'Snowshoestamp Callback recieved',
            'stamp_data': self.stamp_data
        })

Please Note

If you use the SnowshoeStampView then a signal will be issued when recieving callbacks from snowshoestamp, which you can then listen for and do other amazing things.

Signal Example Implementation

from django.dispatch import receiver

from snowshoestamp.signals import snowshoestamp_event


@receiver(snowshoestamp_event)
def on_snowshoestamp_callback(sender, stamp_serial, **kwargs):
    # do something amazing with the data in the kwargs dict
    pass

TODO

  1. tests
  2. more descriptive readme.md
  3. improve setup.py to install from requirements
  4. fix broken python_sdk install cant install from pip lacks setup.py

About

A Django app for integrating with snowshoestamp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages