本文整理汇总了Python中RequestObject.RequestObject.set_request_uri方法的典型用法代码示例。如果您正苦于以下问题:Python RequestObject.set_request_uri方法的具体用法?Python RequestObject.set_request_uri怎么用?Python RequestObject.set_request_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestObject.RequestObject
的用法示例。
在下文中一共展示了RequestObject.set_request_uri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_indicator
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def add_indicator(self, data, indicator_type = None):
""" filter api results by indicator """
# validation indicator
if not SharedMethods.validate_indicator(self.tc._indicators_regex, data):
raise AttributeError(ErrorCodes.e5010.value.format(data))
# get indicator uri attribute
if indicator_type is None:
indicator_type = SharedMethods.get_resource_type(self.tc._indicators_regex, data)
indicator_uri_attribute = ApiProperties.api_properties[indicator_type.name]['uri_attribute']
prop = self._resource_properties['indicator']
ro = RequestObject()
ro.set_description('api filter by indicator id {0}'.format(data))
ro.set_owner_allowed(prop['owner_allowed'])
# TODO: Check this logic
if self._resource_type == ResourceType.INDICATORS:
ro.set_request_uri(prop['uri'], [indicator_uri_attribute, SharedMethods.urlsafe(data)])
else:
ro.set_request_uri(prop['uri'], [SharedMethods.urlsafe(data)])
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(indicator_type)
self._add_request_objects(ro)
示例2: upload
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def upload(self, body):
""" upload document """
if self._resource_type == ResourceType.DOCUMENTS:
prop = self._resource_properties['document_upload']
elif self._resource_type == ResourceType.SIGNATURES:
prop = self._resource_properties['signature_upload']
else:
self._tc.tcl.error('Upload requested for wrong resource type.')
raise AttributeError(ErrorCodes.e10330.value)
ro = RequestObject()
ro.set_body(body)
ro.set_content_type('application/octet-stream')
ro.set_description('upload document for "{0}"'.format(self._name))
# determine whether the file contents exist using phase (not 100%)
if self.phase == 1:
ro.set_http_method(prop['http_method'])
else:
ro.set_http_method('PUT')
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(self._id))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
success_callback = lambda request, response: self.set_contents(request.body)
ro.set_success_callback(success_callback)
self._resource_container.add_commit_queue(self.id, ro)
示例3: add_tag
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def add_tag(self, tag):
""" add a tag to an victim """
prop = self._resource_properties['tag_add']
ro = RequestObject()
ro.set_description('add tag "{0}" to "{1}"'.format(tag, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(self._id, self._urlsafe(tag)))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例4: add_assignee
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def add_assignee(self, assignee):
""" add assignee to task by id """
prop = self._resource_properties['assignee_add']
ro = RequestObject()
ro.set_description('add assignee {0} from "{1}"'.format(assignee, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(
self._id, assignee))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例5: delete_attribute
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def delete_attribute(self, attr_id):
""" delete attribute from victim by id """
prop = self._resource_properties['attribute_delete']
ro = RequestObject()
ro.set_description('delete attribute id {0} from "{1}"'.format(attr_id, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(
self._id, attr_id))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例6: delete_tag
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def delete_tag(self, tag):
""" delete tag from group """
prop = self._resource_properties['tag_delete']
ro = RequestObject()
ro.set_description('delete tag "{0}" from "{1}"'.format(tag, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(
self._id, self._urlsafe(tag)))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例7: delete_security_label
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def delete_security_label(self, label):
""" delete the security label for this indicator """
prop = self._resource_properties['security_label_delete']
ro = RequestObject()
ro.set_description('delete security label "{0}" from {1}'.format(label, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(
self._id, self._urlsafe(label)))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例8: update_asset
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def update_asset(self, asset_id, asset_obj):
""" add a asset to a victim """
prop = self._resource_properties['asset_update']
ro = RequestObject()
ro.set_body(asset_obj.gen_body)
ro.set_description('update asset type {0} with to {1}'.format(asset_obj.resource_type, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(self._id, asset_obj.uri_attribute, asset_id))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例9: delete_escalatee
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def delete_escalatee(self, escalatee):
""" delete escalatee from task by id """
prop = self._resource_properties['escalatee_delete']
ro = RequestObject()
ro.set_description('delete escalatee {0} from "{1}"'.format(escalatee, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(
self._id, escalatee))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例10: associate_indicator
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def associate_indicator(self, indicator_type, indicator):
""" associate a indicator to group by id """
prop = self._resource_properties['association_indicator_add']
ro = RequestObject()
ro.set_description('associate indicator {0} to "{1}"'.format(
indicator, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_resource_pagination(prop['pagination'])
indicator_uri_attribute = ApiProperties.api_properties[indicator_type.name]['uri_attribute']
ro.set_request_uri(prop['uri'].format(indicator_uri_attribute, self._urlsafe(indicator), self.id))
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例11: add_security_label
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def add_security_label(self, label):
""" set the security label for this victim """
prop = self._resource_properties['security_label_add']
ro = RequestObject()
ro.set_description('add security label "{0}" to "{1}"'.format(label, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_resource_pagination(prop['pagination'])
ro.set_request_uri(prop['uri'].format(
self._id, self._urlsafe(label)))
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例12: associate_victim
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def associate_victim(self, resource_id):
""" associate victim from group """
prop = self._resource_properties['association_victim_add']
ro = RequestObject()
ro.set_description('associate victim id {0} from "{1}"'.format(
resource_id, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_request_uri(prop['uri'].format(
self._id, resource_id))
ro.set_resource_pagination(prop['pagination'])
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例13: associate_group
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def associate_group(self, resource_type, resource_id):
""" associate a group to group by id """
prop = self._resource_properties['association_group_add']
ro = RequestObject()
ro.set_description('associate group type "{0}" id {1} to "{2}"'.format(
resource_type.name, resource_id, self._name))
ro.set_http_method(prop['http_method'])
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_resource_pagination(prop['pagination'])
group_uri_attribute = ApiProperties.api_properties[resource_type.name]['uri_attribute']
ro.set_request_uri(prop['uri'].format(self._id, group_uri_attribute, resource_id))
ro.set_resource_type(self._resource_type)
self._resource_container.add_commit_queue(self.id, ro)
示例14: add_tag
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def add_tag(self, data):
""" """
if not isinstance(data, str):
raise AttributeError(ErrorCodes.e4070.value.format(data))
prop = self._resource_properties['tags']
ro = RequestObject()
ro.set_description('api filter by tag "{0}"'.format(data))
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_resource_pagination(prop['pagination'])
ro.set_request_uri(prop['uri'], [SharedMethods.urlsafe(data)])
ro.set_resource_type(self._resource_type)
self._add_request_objects(ro)
示例15: add_victim_id
# 需要导入模块: from RequestObject import RequestObject [as 别名]
# 或者: from RequestObject.RequestObject import set_request_uri [as 别名]
def add_victim_id(self, data_int):
""" """
if not isinstance(data_int, int):
raise AttributeError(ErrorCodes.e4090.value.format(data_int))
prop = self._resource_properties['victims']
ro = RequestObject()
ro.set_description('api filter by victim id {0}'.format(data_int))
ro.set_owner_allowed(prop['owner_allowed'])
ro.set_resource_pagination(prop['pagination'])
ro.set_request_uri(prop['uri'], [data_int])
ro.set_resource_type(self._resource_type)
self._add_request_objects(ro)