How to use the mintapi.api.MintException function in mintapi

To help you get started, we’ve selected a few mintapi 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 mrooney / mintapi / mintapi / api.py View on Github external
'{}/bundledServiceController.xevent?legacy=false&token={}'.format(
                MINT_ROOT_URL, self.token))
        req_id = self.get_request_id_str()
        result = self.post(
            url,
            data={'input': json.dumps([{'args': {'propertyName': name,
                                                 'propertyValue': value},
                                        'service': 'MintUserService',
                                        'task': 'setUserProperty',
                                        'id': req_id}])},
            headers=JSON_HEADER)
        if result.status_code != 200:
            raise MintException('Received HTTP error %d' % result.status_code)
        response = result.text
        if req_id not in response:
            raise MintException(
                'Could not parse response to set_user_property')
github mrooney / mintapi / mintapi / api.py View on Github external
'{}/bundledServiceController.xevent?legacy=false&token={}'.format(
                MINT_ROOT_URL, self.token))
        req_id = self.get_request_id_str()
        result = self.post(
            url,
            data={'input': json.dumps([{'args': {'propertyName': name,
                                                 'propertyValue': value},
                                        'service': 'MintUserService',
                                        'task': 'setUserProperty',
                                        'id': req_id}])},
            headers=JSON_HEADER)
        if result.status_code != 200:
            raise MintException('Received HTTP error %d' % result.status_code)
        response = result.text
        if req_id not in response:
            raise MintException(
                'Could not parse response to set_user_property')
github mrooney / mintapi / mintapi / api.py View on Github external
'excludedCategories': [],
                    'sortByPrecedence': False,
                    'categoryTypeFilter': 'FREE'
                },
                'id': req_id,
                'service': 'MintCategoryService',
                'task': 'getCategoryTreeDto2'
            }])
        }

        cat_url = (
            '{}/bundledServiceController.xevent?legacy=false&token={}'.format(
                MINT_ROOT_URL, self.token))
        response = self.post(cat_url, data=data, headers=JSON_HEADER).text
        if req_id not in response:
            raise MintException('Could not parse category data: "' +
                                response + '"')
        response = json.loads(response)
        response = response['response'][req_id]['response']

        # Build category list
        categories = {}
        for category in response['allCategories']:
            categories[category['id']] = category

        return categories
github mrooney / mintapi / mintapi / api.py View on Github external
def set_user_property(self, name, value):
        url = (
            '{}/bundledServiceController.xevent?legacy=false&token={}'.format(
                MINT_ROOT_URL, self.token))
        req_id = self.get_request_id_str()
        result = self.post(
            url,
            data={'input': json.dumps([{'args': {'propertyName': name,
                                                 'propertyValue': value},
                                        'service': 'MintUserService',
                                        'task': 'setUserProperty',
                                        'id': req_id}])},
            headers=JSON_HEADER)
        if result.status_code != 200:
            raise MintException('Received HTTP error %d' % result.status_code)
        response = result.text
        if req_id not in response:
            raise MintException(
                'Could not parse response to set_user_property')
github mrooney / mintapi / mintapi / api.py View on Github external
def set_user_property(self, name, value):
        url = (
            '{}/bundledServiceController.xevent?legacy=false&token={}'.format(
                MINT_ROOT_URL, self.token))
        req_id = self.get_request_id_str()
        result = self.post(
            url,
            data={'input': json.dumps([{'args': {'propertyName': name,
                                                 'propertyValue': value},
                                        'service': 'MintUserService',
                                        'task': 'setUserProperty',
                                        'id': req_id}])},
            headers=JSON_HEADER)
        if result.status_code != 200:
            raise MintException('Received HTTP error %d' % result.status_code)
        response = result.text
        if req_id not in response:
            raise MintException(
                'Could not parse response to set_user_property')