Did I find the right examples for you? yes no

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
Look in the current environment for Twilio credentials

:param environ: the environment to check

        def find_credentials(environ=None):
    """
    Look in the current environment for Twilio credentials

    :param environ: the environment to check
    """
    environment = environ or os.environ
    try:
        account = environment["TWILIO_ACCOUNT_SID"]
        token = environment["TWILIO_AUTH_TOKEN"]
        return account, token
    except KeyError:
        return None, None
        


src/t/w/twilio-python-HEAD/tests/test_credentials.py   twilio-python(Download)
from nose.tools import assert_equal, assert_raises
from mock import patch
 
from twilio import TwilioException
from twilio.rest import TwilioRestClient, find_credentials
 
 
def test_creds_not_found():
    """ I shouldn't find credentials if they are not there """
    assert_equal(find_credentials({'foo': 'bar'}), (None, None))
        'TWILIO_AUTH_TOKEN': '456',
    }
    assert_equal(find_credentials(env), ('AC123', '456'))