openc2lib.types.data.uri
1import uritools 2 3class URI: 4 """ RFC 3986 compliant URI 5 6 This class is used to hold and check URI according to RFC 3986. For the purpose of OpenC2, 7 URIs are just seen as plain strings, so no parsing function is provided. 8 """ 9 10 def __init__(self, uri: str): 11 """ Initialize an URI 12 13 'URI' can be initialized only with strings that corresponds to RFC 3968 valid URIs. 14 """ 15 if uritools.isuri(uri): 16 self._uri = uri 17 else: 18 raise ValueError("Invalid URI") 19 20 def get(self): 21 """ Returns the content of the URI """ 22 return self._uri 23 24 25 def __str__(self): 26 return self._uri
class
URI:
4class URI: 5 """ RFC 3986 compliant URI 6 7 This class is used to hold and check URI according to RFC 3986. For the purpose of OpenC2, 8 URIs are just seen as plain strings, so no parsing function is provided. 9 """ 10 11 def __init__(self, uri: str): 12 """ Initialize an URI 13 14 'URI' can be initialized only with strings that corresponds to RFC 3968 valid URIs. 15 """ 16 if uritools.isuri(uri): 17 self._uri = uri 18 else: 19 raise ValueError("Invalid URI") 20 21 def get(self): 22 """ Returns the content of the URI """ 23 return self._uri 24 25 26 def __str__(self): 27 return self._uri
RFC 3986 compliant URI
This class is used to hold and check URI according to RFC 3986. For the purpose of OpenC2, URIs are just seen as plain strings, so no parsing function is provided.
URI(uri: str)
11 def __init__(self, uri: str): 12 """ Initialize an URI 13 14 'URI' can be initialized only with strings that corresponds to RFC 3968 valid URIs. 15 """ 16 if uritools.isuri(uri): 17 self._uri = uri 18 else: 19 raise ValueError("Invalid URI")
Initialize an URI
'URI' can be initialized only with strings that corresponds to RFC 3968 valid URIs.