Esempio n. 1
0
 def _create_node(self, api_client, node_data):
     node_url = '{root}/node.json'.format(root=api_client.api_url)
     response = api_client.api_session.post(node_url, data=json.dumps(node_data))
     if response.status_code == 201:
         response_json = response.json()
         return response_json
     else:
         logger.exception('Failed to create person node to marketing site [%s].', response.content)
         raise PersonToMarketingException("Marketing site Person page creation failed!")
Esempio n. 2
0
 def _update_node(self, api_client, node_id, node_data):
     node_url = f'{api_client.api_url}/node.json/{node_id}'
     response = api_client.api_session.put(node_url,
                                           data=json.dumps(node_data))
     if response.status_code == 200:
         response_json = response.json()
         return response_json
     else:
         logger.exception(
             'Failed to update person node on marketing site [%s].',
             response.content)
         raise PersonToMarketingException(
             "Marketing site Person page update failed!")
Esempio n. 3
0
 def _get_node_id_from_uuid(self, api_client, uuid):
     node_url = f'{api_client.api_url}/node.json?uuid={uuid}'
     response = api_client.api_session.get(node_url)
     if response.status_code == 200:
         response_json = response.json()
         person_list = response_json.get('list')
         return person_list[0].get('nid') if person_list else None
     else:
         logger.exception(
             'Failed to update person node on marketing site [%s].',
             response.content)
         raise PersonToMarketingException(
             "Marketing site Person page update failed!")