Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'{}/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')
'{}/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')
'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
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')
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')