def build_relationship(self, Left_TLO, Right_TLO):
right_type = Right_TLO.type[:1].upper() + Right_TLO.type[1:] #handles CAPS issue
submit_url = '{}/{}/{}/'.format(self.url, Left_TLO.collection, Left_TLO.get_ID())
params = {'api_key': self.api_key,'username': self.username}
data = {
'action': 'forge_relationship',
'type_': Left_TLO.type,
'id_': Left_TLO.get_ID(),
'right_type': right_type,
'right_id': Right_TLO.get_ID(),
'rel_type': 'Related To',
'rel_date': datetime.datetime.now(),
'rel_reason': '',
'rel_confidence': 'low',
'get_rels': True
}
r = requests.patch(submit_url, params=params, data=data, verify=False)
if r.status_code == 200:
return json.loads(r.text)
else:
return None
评论列表
文章目录