KeyChain

KeyChain - is a kind of storage for connectors' tokens. Besides it has some useful methods, like: generating valid token fram raw login data, or checking token's validity. KeyChain class located in the smapy.network_connectors.addons section.

Important!

All tokens are stored without any encryption. So be careful, using your real and valuable network profiles and/or dumping data to distrusting places. Keep in mind, that you are using this functionality at your won risk.

Read more on how to get tokens for different networks:

Documentation

class smapy.KeyChain()

Public methods:

Example

>>> from smapy import KeyChain
>>> token_collection = KeyChain()
>>> token_collection.assign('fb', 'tHiS_iS_mY_sAmPlE_tOkEn')
>>> token_collection.check('fb') # Token from this example neither real, nor valid. So:
False
>>> token_collection.dump() # Saving it on disk
>>> token_collection.assign('fb', 'ChAnGeD_vErSiOn_Of_ToKeN') # Changing Facebook-token value
>>> token_collection.get('fb')
'ChAnGeD_vErSiOn_Of_ToKeN'
>>> token_collection.load_last() # Loading token collection from last dump
>>> token_collection.get('fb')
'tHiS_iS_mY_sAmPlE_tOkEn'
>>> token_collection.get('ig') # We have not specified Instagram token yet
None