Skip to content

Commit

Permalink
Fix cookie name on py3 and add get_snapshot() to camera interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kk7ds committed Feb 6, 2016
1 parent 82765c6 commit a6b52d5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion uvcclient/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def login(self):
conn.request('GET', '/')
resp = conn.getresponse()
headers = dict(resp.getheaders())
self._cookie = headers['set-cookie']
self._cookie = headers['Set-Cookie']
session = self._cookie.split('=')[1].split(';')[0]

try:
Expand Down Expand Up @@ -74,3 +74,10 @@ def _cfgwrite(self, setting, value):

def set_led(self, enabled):
return self._cfgwrite('led.front.status', int(enabled))

def get_snapshot(self):
conn = httplib.HTTPConnection(self._host, self._port)
headers = {'Cookie': self._cookie}
conn.request('GET', '/snapshot.cgi',
headers=headers)
return conn.getresponse().read()

0 comments on commit a6b52d5

Please sign in to comment.