コード例 #1
0
ファイル: user.py プロジェクト: kaptainkommie/Python-SDK
def auth_token(apikey=None, secretkey=None):
    ''' Generate an auth token

    If the apikey and/or secretkey are not specified as parameters,
    then they will be resolved, if possible.
    '''

    if apikey is None:
        apikey = resolve_apikey()

    if secretkey is None:
        secretkey = resolve_secretkey()

    return get(action='authToken', apikey=apikey,
               secretkey=secretkey)['authToken']
コード例 #2
0
ファイル: user.py プロジェクト: SeanYa/Python-SDK
def auth_token(apikey=None, secretkey=None):
    ''' Generate an auth token

    If the apikey and/or secretkey are not specified as parameters,
    then they will be resolved, if possible.
    '''

    if apikey is None:
        apikey = resolve_apikey()

    if secretkey is None:
        secretkey = resolve_secretkey()

    return get(action='authToken', apikey=apikey,
               secretkey=secretkey)['authToken']
コード例 #3
0
ファイル: test_user.py プロジェクト: kaptainkommie/Python-SDK
 def test_secretkey(self):
     apikey = resolve_apikey()
     expected_secretkey = resolve_secretkey()
     returned_secretkey = monitis.user.secretkey()
     assert_equal(expected_secretkey, returned_secretkey)
コード例 #4
0
ファイル: test_api.py プロジェクト: SeanYa/Python-SDK
 def test_get(self):
     # this test needs a simple API call, secretkey fits the bill
     # http://www.monitis.com/api?action=secretkey&apikey=${MONITIS_APIKEY}
     secret_key = get(action='secretkey')['secretkey']
     assert_equals(secret_key,resolve_secretkey())
コード例 #5
0
ファイル: test_api.py プロジェクト: SeanYa/Python-SDK
 def test_resolve_secretkey(self):
     secretkey = resolve_secretkey()
     matched = match('^[0-9A-Z]{26}$', secretkey)
     assert matched is not None
コード例 #6
0
ファイル: test_api.py プロジェクト: kaptainkommie/Python-SDK
 def test_get(self):
     # this test needs a simple API call, secretkey fits the bill
     # http://www.monitis.com/api?action=secretkey&apikey=${MONITIS_APIKEY}
     secret_key = get(action='secretkey')['secretkey']
     assert_equals(secret_key, resolve_secretkey())
コード例 #7
0
ファイル: test_api.py プロジェクト: kaptainkommie/Python-SDK
 def test_resolve_secretkey(self):
     secretkey = resolve_secretkey()
     matched = match('^[0-9A-Z]{26}$', secretkey)
     assert matched is not None