Package: launchkey-python
## Python SDK for LaunchKey API  [![Build Status](https://travis-ci.org/LaunchKey/launchkey-python.png?branch=master)](https://travis-ci.org/LaunchKey/launchkey-python)For use in implementing LaunchKeyVersion 1.3.0@author LaunchKey@updated 2016-04-22########################### DescriptionUse to more easily interact with LaunchKey's API.########################### Installation$ easy_install launchkey-pythonor$ pip launchkey-python########################### Usage### To create a LaunchKey API objectimport launchkey#app_key will be provided in the dashboardapp_key = 1234567890#app_secret will be provided in the dashboard once, or a new one may be generatedapp_secret = "abcdefghijklmnopqrstuvwxyz123456"private_key = open("path/to/key.pem", "r").read()api = launchkey.API(app_key, app_secret, private_key)### When a user wishes to login#Set session to False if it's a transactional authorization and a session doesn't need to be kept#If session is not specified it will automatically default to Truesession = True#Set user_push_id to True if you would like to be returned a value that can be used to push requests to the user in the future#If user_push_id is not specified it will automatically default to Falseuser_push_id = Falseauth_request = api.authorize(username, session, user_push_id)### To check up on whether that user has launched or notlaunch_status = poll_request(auth_request)### To figure out whether the user authorized or denied the requestif api.is_authorized(auth_request, launch_status['auth']):#Now log the user in### When a user logs outapi.logout(auth_request)### Dealing with Callbacks (Webhooks)Receiving an authorization#You will get auth_request, auth, and user_hash information in a JSON stringauth_request = request.params['auth_request']auth = request.params['auth']user_hash = request.params['user_hash']#Identify the user's session by the correlating auth_request#Then use the is_authorized function to completesuccess = api.is_authorized(auth_request, auth)Receiving a deorbit request#You will receive two parameters: deorbit and signaturedeorbit = request.params['deorbit']signature = request.params['signature']#Use the deorbit function with these parameters to get the user_hash to logoutuser_hash = api.deorbit(deorbit, signature)#If you've kept the auth_request stored for the correlating user_hash you can look it up#and use it now to log the user out#auth_request = get_auth_request_from_user_hash(user_hash)api.logout(auth_request)### White LabelYou can add users to your White Label Group via an App that belongs to the group using the new call.response = api.create_whitelabel_user("identifier")It is important to note that the identifier sent in should be sent as a string and should be a non-changing value uniqueto that user. It is recommended to use a primary key or UUID instead of a username or email address that could besubject to change.  This identifier will be used authenticate the user as well as pair devices additional devices to theuser's account within your white label group.The response will include qrcode and code. The qrcode is a url to an image of the QR Code for the mobile application toscan. The code is a value that can be entered in the mobile application in the event the QR Code cannot be scanned.########################### Tests$ python setup.py test########################### Contributing1. Fork it2. Create your feature branch (`git checkout -b my-new-feature`)3. Commit your changes (`git commit -am 'Add some feature'`)4. Push to the branch (`git push origin my-new-feature`)5. Create new Pull RequestCHANGELOG for LaunchKey Python SDK==================================1.3.0-----Python 3 compatibility.Ability to send policies in auth request.1.2.7-----Update manifest for new CHANGES file1.2.6-----Fix for bad build regarding CHANGES.md1.2.5-----Remove references to LK Identifier as the API no longer returns it.