The urlDNA Python package allows you to interact with the URLDNA API for scanning and analyzing URLs. With this package, you can retrieve scan results, extract metadata, and detect potential threats.
url = 'https://urldna.io'# Create a new scan and wait until the scan status is DONE or ERRORscan_result = client.create_scan(url)
Copy
url = 'https://urldna.io'# Create a new scan and return the scan object while its status is still PENDING or RUNNINGscan = client.async_create_scan(url)scan_id = scan.id # Use this id to fecth scan result
scan_result = client.get_scan(scan_id)# Print various scan resultsprint(scan_result.cookies) # List of cookies found on the webpageprint(scan_result.dom) # Full HTML source code of the pageprint(scan_result.favicon) # Favicon details, including hash and URLprint(scan_result.http_transactions) # List of all HTTP requests and responsesprint(scan_result.ip_address) # IP address associated with the scanned URLprint(scan_result.scan_whois) # WHOIS registration detailsprint(scan_result.malicious) # Indicates whether the URL is flagged as malicious (beta feature)print(scan_result.page) # Extracted meta tags, headers, and text contentprint(scan_result.screenshot) # URL of the captured webpage screenshotprint(scan_result.technologies) # List of detected technologies used on the siteprint(scan_result.scan_feedback) # User-submitted feedback on the scan
# Submit user feedback for a scan (marking the URL as MALICIOUS or SAFE)scan_feedback = client.scan_feedback(scan_id, "MALICIOUS") print(scan_feedback.malicious_count) # Number of users who marked this as malicious
url = 'https://urldna.io'# Perform a quick reputation check on the URL (returns cached results if available)response = client.fast_check(url)print(response.status) # Possible values: MALICIOUS, SAFE, or UNRATED