MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / fetch_response

Function fetch_response

vulnerabilities/utils.py:393–406  ·  view source on GitHub ↗

Fetch and return `response` from the `url`

(url)

Source from the content-addressed store, hash-verified

391
392
393def fetch_response(url):
394 """
395 Fetch and return `response` from the `url`
396 """
397 try:
398 response = requests.get(url)
399 if response.status_code == HTTPStatus.OK:
400 return response
401 raise Exception(
402 f"Failed to fetch data from {url!r} with status code: {response.status_code!r}"
403 )
404 except Exception as e:
405 logger.error(f"Error fetching data from {url!r}: {e}")
406 return None
407
408
409# This should be a method on PackageURL

Callers 10

get_status_from_apiFunction · 0.90
collect_advisoriesMethod · 0.90
get_xsa_dataMethod · 0.90
get_mattermost_dataMethod · 0.90
get_responseMethod · 0.90
fetch_dataMethod · 0.90
fetchMethod · 0.90
fetchMethod · 0.90
advisory_dataMethod · 0.90
fetchMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected