Data¶
-
class
libs.
Data
(pbp_handle)¶ To control MySQL for PBP
-
check_blacklist
(url: str)¶ To check URL whether exists in blacklist
Parameters: url – URL Returns: dict of URL and Mark-Date or NoneType
-
check_trust_domain
(domain: str)¶ To check URL whether exists in trust_domain list
Parameters: domain – domain Returns: string of UUID or NoneType
-
check_trustlist
(url: str)¶ To check URL whether exists in trustlist
Parameters: url – URL Returns: string of UUID or NoneType
-
check_warnlist
(url: str)¶ To check URL whether exists in warnlist
Parameters: url – URL Returns: dict of URL, similar URL and Mark-Date or NoneType
-
clean_result_cache
()¶ Clean result caches
Returns: True
-
find_page_by_view_signature
(signature: str)¶ Search URL by view_signature in trustlist
Parameters: signature – string hashed Returns: URL or NoneType
-
find_result_cache_by_url_hash
(url_hash: str)¶ Search cache by url_hash in result_cache
Parameters: url_hash – URL hashed Returns: float of the-trust-score or NoneType
-
get_urls_from_trustlist
()¶ Fetch all URL in trustlist
Returns: list of URL
-
get_view_narray_from_trustlist
()¶ Fetch all target_view_narray in trustlist
Returns: dict of URL and NumPy Array
-
mark_as_blacklist
(url: str)¶ Mark URL to blacklist by Database
Parameters: url – URL to mark Returns: True
-
mark_as_blacklist_mass
(urls: list)¶ Mark URLs to blacklist by Database
Parameters: url – URLs to mark Returns: True
-
mark_as_warnlist
(url: str, origin_url: str)¶ Mark URL to warnlist by PageView
Parameters: - url – URL to mark
- origin_url – the URL similar to
Returns: True
-
upload_result_cache
(url_hash: str, score: float)¶ Upload the-trust-score to cache
Parameters: - url_hash – URL hashed
- score – float of the-trust-score
Returns:
-
upload_view_sample
(url: str, view_signature: str, view_data: str)¶ Upload ViewSample for PageView
Parameters: - url – URL of Sample
- view_signature – string hashed with view_data
- view_data – string of num array base64 encoded
Returns: True
-