How to use the mkmsdk.utils.get_mkm_app_secret function in mkmsdk

To help you get started, we’ve selected a few mkmsdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github evonove / mkm-sdk / tests / tests_unit / test_api.py View on Github external
def test_missing_env_var_raise_exception_correctly(mocker):
    """Verifies that an expection is thrown when necessary env vars are missing."""
    os_mocked = mocker.patch("mkmsdk.utils.os")
    os_mocked.environ = {}
    with pytest.raises(exceptions.MissingEnvVar):
        get_mkm_app_secret()
github evonove / mkm-sdk / mkmsdk / api.py View on Github external
This is done because MKM expects an authorization header with certain parameters
        even if they're empty strings.

        Params:
            `url`: URL where request is submitted
            `app_token`: use this app token instead of the one in env vars
            `app_secret`: use this app secret instead of the one in env vars
            `access_token`: use this access token instead of the one in env vars
            `access_token_secret`: use this access token secret instead of the one in env vars

        Return:
            `auth`: Returns an instance of `MKMOAuth1` with `url` as realm
        """

        app_token = app_token if app_token is not None else get_mkm_app_token()
        app_secret = app_secret if app_secret is not None else get_mkm_app_secret()
        access_token = access_token if access_token is not None else get_mkm_access_token()
        access_token_secret = access_token_secret if access_token_secret is not None else get_mkm_access_token_secret()

        # If access_token and access_token_secret are empty strings a personalized OAuth1 Client is used.
        # This is done because that would mean the user is using a Widget Application and having empty strings
        # as tokens causes issues with the default Client
        if not access_token and not access_token_secret:
            client = MKMClient
        else:
            client = Client

        return MKMOAuth1(
            app_token,
            client_secret=app_secret,
            resource_owner_key=access_token,
            resource_owner_secret=access_token_secret,