Thanx, this wont work with my camera, mayby someone can help me
I have an Axis IP camera, and the download link for an snapshot is
- Code: Select all
http://192.168.213.238/jpg/image.jpg
So i tried this
- Code: Select all
import urllib2
import base64
devIP = "192.168.213.238"
username = "xxxxx"
password = "xxxxx"
request = urllib2.Request("http://%s/jpg/image.jpg" % devIP)
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
buffer = urllib2.urlopen(request).read()
f = open(img, 'wb')
f.write(buffer)
f.close()
A get an HTTP Error 401: Unauthorized
if i change the path of the image to something wrong that do not exist i get
HTTP Error 404: Not found
so it seems like the script do go to the correct place, but is not able to log in?
If a use a browser, this way will work to se the image
- Code: Select all
http://username:password@192.168.213.238/jpg/image.jpg
Can anyone figure out why this is not working?
/Martin