How to use the predicthq.config.config function in predicthq

To help you get started, we’ve selected a few predicthq 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 predicthq / sdk-py / tests / __init__.py View on Github external
def wrapper(*args, **kwargs):
            old_config = {}

            for key, value in six.iteritems(new_config):
                old_config[key] = getattr(config, key)
                setattr(config, key, value)

            result = f(*args, **kwargs)

            for key, value in six.iteritems(old_config):
                setattr(config, key, value)

            return result
        return wrapper
github predicthq / sdk-py / tests / __init__.py View on Github external
def wrapper(*args, **kwargs):
            old_config = {}

            for key, value in six.iteritems(new_config):
                old_config[key] = getattr(config, key)
                setattr(config, key, value)

            result = f(*args, **kwargs)

            for key, value in six.iteritems(old_config):
                setattr(config, key, value)

            return result
        return wrapper
github predicthq / sdk-py / predicthq / endpoints / oauth2 / schemas.py View on Github external
from predicthq.config import config
from predicthq.endpoints.schemas import Model, StringType, StringListType, IntType


class GetTokenParams(Model):

    class Options:
        serialize_when_none = False

    client_id = StringType(default=lambda: config.OAUTH2_CLIENT_ID, required=True)
    client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)
    scope = StringListType(StringType, default=lambda: config.OAUTH2_SCOPE, separator=" ")
    grant_type = StringType(choices=('client_credentials',), default='client_credentials', required=True)


class RevokeTokenParams(Model):

    class Options:
        serialize_when_none = False

    client_id = StringType(default=lambda: config.OAUTH2_CLIENT_ID, required=True)
    client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)
    token = StringType(required=True)
    token_type_hint = StringType(choices=('access_token', 'refresh_token'), default='access_token', required=True)
github predicthq / sdk-py / predicthq / client.py View on Github external
def __init__(self, access_token=None):
        self.logger = logging.getLogger('predicthq')
        self.logger.setLevel(config.LOGGING_LOG_LEVEL)
        self.access_token = access_token or config.OAUTH2_ACCESS_TOKEN
        self.initialize_endpoints()
github predicthq / sdk-py / predicthq / endpoints / oauth2 / schemas.py View on Github external
    client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)
    scope = StringListType(StringType, default=lambda: config.OAUTH2_SCOPE, separator=" ")
github predicthq / sdk-py / predicthq / endpoints / oauth2 / schemas.py View on Github external
    client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)
    token = StringType(required=True)
github predicthq / sdk-py / predicthq / client.py View on Github external
def build_url(cls, path):
        result = list(six.moves.urllib.parse.urlparse(path))
        result[2] = "/{}/".format(result[2].strip('/'))
        return six.moves.urllib.parse.urljoin(config.ENDPOINT_URL, six.moves.urllib.parse.urlunparse(result))
github predicthq / sdk-py / predicthq / client.py View on Github external
def __init__(self, access_token=None):
        self.logger = logging.getLogger('predicthq')
        self.logger.setLevel(config.LOGGING_LOG_LEVEL)
        self.access_token = access_token or config.OAUTH2_ACCESS_TOKEN
        self.initialize_endpoints()
github predicthq / sdk-py / predicthq / endpoints / oauth2 / schemas.py View on Github external
    client_id = StringType(default=lambda: config.OAUTH2_CLIENT_ID, required=True)
    client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)