Currently I am doing as follow, to getting response and save the file locally in my PC-
response = requests.get(url)
if response.status_code != status.HTTP_200_OK:
raise BadRequestError('message')
return subprocess.call(['wget', url])
But what I want, to save the response In my PC when response = requests.get(url)
with error handling, instead of doing subprocess.call(['wget', url])
again.
Any help would be appreciated.