So,
curl is doing 2 things for you here: it's downloading the image data, then it's storing it in the specified file. In Python, this would be two steps: have
requests download the data, then write the data to a file:
- Code: Select all
import requests
url = 'http://192.168.11.xxx:7080/api/2.0/snapshot/camera/yyyyyyyyyyyyyyyy?force=true&apiKey=zzzzzzzzzz'
# Make the request and get the reply
reply = requests.get(url)
# This will raise an exception if the request returned an error
reply.raise_for_status()
# Save the content to a file
with open('/full/path/to/Documents/DrivewayFolder/Driveway0.jpg', 'wb') as image_file:
image_file.write(reply.content)
Untested but it should be close.