当前位置: 首页>>代码示例>>Python>>正文


Python URI.object_from_dict方法代码示例

本文整理汇总了Python中cybox.objects.uri_object.URI.object_from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python URI.object_from_dict方法的具体用法?Python URI.object_from_dict怎么用?Python URI.object_from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cybox.objects.uri_object.URI的用法示例。


在下文中一共展示了URI.object_from_dict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_round_trip2

# 需要导入模块: from cybox.objects.uri_object import URI [as 别名]
# 或者: from cybox.objects.uri_object.URI import object_from_dict [as 别名]
 def test_round_trip2(self):
     uri_dict = {'value': "http://www.example.com", 'type': URI.TYPE_URL}
     uri_obj = URI.object_from_dict(uri_dict)
     uri_dict2 = URI.dict_from_object(uri_obj)
     self.assertEqual(uri_dict, uri_dict2)
开发者ID:2xyo,项目名称:python-cybox,代码行数:7,代码来源:uri_test.py

示例2: test_no_type

# 需要导入模块: from cybox.objects.uri_object import URI [as 别名]
# 或者: from cybox.objects.uri_object.URI import object_from_dict [as 别名]
 def test_no_type(self):
     uri_dict = {'value': "http://www.example.com",
                 'xsi:type': URI._XSI_TYPE}
     uri_obj = URI.object_from_dict(uri_dict)
     uri_dict2 = URI.dict_from_object(uri_obj)
     self.assertEqual(uri_dict, uri_dict2)
开发者ID:bauer1j,项目名称:python-cybox,代码行数:8,代码来源:uri_test.py

示例3: __parse_http_server_response

# 需要导入模块: from cybox.objects.uri_object import URI [as 别名]
# 或者: from cybox.objects.uri_object.URI import object_from_dict [as 别名]
 def __parse_http_server_response(cls, http_server_response):
     http_server_response_dict = {}
     if http_server_response.get_HTTP_Status_Line() is not None:
         server_status_line = http_server_response.get_HTTP_Status_Line() 
         server_status_line_dict = {}
         if server_status_line_dict.get_Version() is not None:
             server_status_line_dict['version'] = Base_Object_Attribute.dict_from_object(server_status_line.get_Version())
         if server_status_line_dict.get_Status_Code() is not None:
             server_status_line_dict['status_code'] = Base_Object_Attribute.dict_from_object(server_status_line.get_Status_Code())
         if server_status_line_dict.get_Reason_Phrase() is not None:
             server_status_line_dict['reason_phrase'] = Base_Object_Attribute.dict_from_object(server_status_line.get_Reason_Phrase())
         http_server_response_dict['http_status_line'] = server_status_line_dict
     if http_server_response.get_HTTP_Response_Header() is not None:
         response_header = http_server_response.get_HTTP_Response_Header()
         response_header_dict = {}
         if response_header.get_Raw_Header() is not None:
             response_header_dict['raw_header'] = response_header.get_Raw_Header()
         if response_header.get_Parsed_Header() is not None:
             parsed_header = response_header.get_Parsed_Header()
             parsed_header_dict = {}
             if parsed_header.get_Access_Control_Allow_Origin() is not None: parsed_header_dict['access-control-allow-origin'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Access_Control_Allow_Origin())
             if parsed_header.get_Accept_Ranges() is not None: parsed_header_dict['accept-ranges'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Accept_Ranges())
             if parsed_header.get_Age() is not None: parsed_header_dict['age'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Age())
             if parsed_header.get_Cache_Control() is not None: parsed_header_dict['cache-control'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Cache_Control())
             if parsed_header.get_Connection() is not None: parsed_header_dict['connection'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Connection())
             if parsed_header.get_Content_Encoding() is not None: parsed_header_dict['content-encoding'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Encoding())
             if parsed_header.get_Content_Language() is not None: parsed_header_dict['content-language'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Language())
             if parsed_header.get_Content_Length() is not None: parsed_header_dict['content-length'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Length())
             if parsed_header.get_Content_Location() is not None: parsed_header_dict['content-location'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Location())
             if parsed_header.get_Content_MD5() is not None: parsed_header_dict['content-md5'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_MD5())
             if parsed_header.get_Content_Disposition() is not None: parsed_header_dict['content-disposition'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Disposition())
             if parsed_header.get_Content_Range() is not None: parsed_header_dict['content-range'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Range())
             if parsed_header.get_Content_Type() is not None: parsed_header_dict['content-type'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Content_Type())
             if parsed_header.get_Date() is not None: parsed_header_dict['date'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Date())
             if parsed_header.get_ETag() is not None: parsed_header_dict['etag'] = Base_Object_Attribute.dict_from_object(parsed_header.get_ETag())
             if parsed_header.get_Expires() is not None: parsed_header_dict['expires'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Expires())
             if parsed_header.get_Last_Modified() is not None: parsed_header_dict['last-modified'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Last_Modified())
             if parsed_header.get_Link() is not None: parsed_header_dict['link'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Link())
             if parsed_header.get_Location() is not None: parsed_header_dict['location'] = URI.object_from_dict(parsed_header.get_Location())
             if parsed_header.get_P3P() is not None: parsed_header_dict['p3p'] = Base_Object_Attribute.dict_from_object(parsed_header.get_P3P())
             if parsed_header.get_Pragma() is not None: parsed_header_dict['pragma'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Pragma())
             if parsed_header.get_Proxy_Authenticate() is not None: parsed_header_dict['proxy-authenticate'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Proxy_Authenticate())
             if parsed_header.get_Refresh() is not None: parsed_header_dict['refresh'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Refresh())
             if parsed_header.get_Retry_After() is not None: parsed_header_dict['retry-after'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Retry_After())
             if parsed_header.get_Server() is not None: parsed_header_dict['server'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Server())
             if parsed_header.get_Set_Cookie() is not None: parsed_header_dict['set-cookie'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Set_Cookie())
             if parsed_header.get_Strict_Transport_Security() is not None: parsed_header_dict['strict-transport-security'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Strict_Transport_Security())
             if parsed_header.get_Trailer() is not None: parsed_header_dict['trailer'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Trailer())
             if parsed_header.get_Transfer_Encoding() is not None: parsed_header_dict['transfer-encoding'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Transfer_Encoding())
             if parsed_header.get_Vary() is not None: parsed_header_dict['vary'] = URI.dict_from_object(parsed_header.get_Vary(), vary_dict)
             if parsed_header.get_Via() is not None: parsed_header_dict['via'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Via())
             if parsed_header.get_Warning() is not None: parsed_header_dict['warning'] = Base_Object_Attribute.dict_from_object(parsed_header.get_Warning())
             if parsed_header.get_WWW_Authenticate() is not None: parsed_header_dict['www-authenticate'] = Base_Object_Attribute.dict_from_object(parsed_header.get_WWW_Authenticate())
             if parsed_header.get_X_Frame_Options() is not None: parsed_header_dict['x-frame-options'] = Base_Object_Attribute.dict_from_object(parsed_header.get_X_Frame_Options())
             if parsed_header.get_X_XSS_Protection() is not None: parsed_header_dict['x-xss-protection'] = Base_Object_Attribute.dict_from_object(parsed_header.get_X_XSS_Protection())
             if parsed_header.get_X_Content_Type_Options() is not None: parsed_header_dict['x-content-type-options'] = Base_Object_Attribute.dict_from_object(parsed_header.get_X_Content_Type_Options())
             if parsed_header.get_X_Forwarded_Proto() is not None: parsed_header_dict['x-forwarded-proto'] = Base_Object_Attribute.dict_from_object(parsed_header.get_X_Forwareded_Proto())
             if parsed_header.get_X_Powered_By() is not None: parsed_header_dict['x-powered-by'] = Base_Object_Attribute.dict_from_object(parsed_header.get_X_Powered_By())
             if parsed_header.get_X_UA_Compatible() is not None: parsed_header_dict['x-ua-compatible'] = Base_Object_Attribute.dict_from_object(parsed_header.get_X_UA_Compatible())
             response_header_dict['parsed_header'] = parsed_header_dict
         http_server_response_dict['http_response_header'] = response_header_dict
     if http_server_response.get_HTTP_Message_Body() is not None:
         message_body = http_server_response.get_HTTP_Message_Body()
         message_body_dict = {}
         if message_body.get_Length() is not None: message_body_dict['length'] = Base_Object_Attribute.dict_from_object(message_body.get_Length())
         if message_body.get_Message_Body() is not None: message_body_dict['message_body'] = Base_Object_Attribute.dict_from_object(message_body.get_Message_Body())
         http_server_response_dict['http_message_body'] = message_body_dict 
     return http_server_response_dict
开发者ID:2xyo,项目名称:python-cybox,代码行数:70,代码来源:http_session_object.py


注:本文中的cybox.objects.uri_object.URI.object_from_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。