Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self, params={}):
response = requests.get(f"{self.connection.server}/result/{params[Input.SCAN_ID]}",
headers=self.connection.headers)
try:
js = response.json()
except json.JSONDecodeError as e:
raise PluginException(cause="Received an unexpected response from the Urlscan API. ",
assistance=f"(non-JSON or no response was received). Response was: {response.text}",
data=e)
# Non-200 status code responses should have a JSON payload containing message, description, and status code
# Display those values to the user for assistance purposes.
# See: https://urlscan.io/about-api/#errors
if response.status_code != 200:
if response.status_code == 404:
raise PluginException(cause="The requested scan results were not found. ",
assistance="If you are running this action directly after a new scan, "