🔍 Overview

The GoogleSafeBrowsing class provides an interface to Google’s Safe Browsing API (v4) for checking Links against known threat lists. It handles API communication, payload construction, and response processing.


📑 Class Attributes

AttributeTypeDescription
URLstrEndpoint URL constructed from settings.GOOGLE_SAFEBROWSING_BASE_URL
API_KEYstrAPI key loaded from settings.GOOGLE_SAFEBROWSING_API_KEY

🧩 Methods

MethodDescription
_build_payload(links)Constructs the API request payload from a list of links.
_send_request(links)Sends the request to the Google Safe Browsing API and returns the response.
check_links(links)Public method to check a list of links/domains against the Google Safe Browsing API.

📍 Where Using

  • Block links tasks - checks links and blocks them if they are found in Google Safe Browsing lists.
  • Unblock links tasks - unblocks links that were previously blocked by Google Safe Browsing.