crits_API.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:CritsAide 作者: corumir 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号