def do_GET(self): self.send_response(200) # Response headers (multipart) for k, v in pymjpeg.request_headers().items(): self.send_header(k, v) # Multipart content for filename in glob('img/*'): # Part boundary string self.end_headers() self.wfile.write(pymjpeg.boundary) self.end_headers() # Part headers for k, v in pymjpeg.image_headers(filename).items(): self.send_header(k, v) self.end_headers() # Part binary for chunk in pymjpeg.image(filename): self.wfile.write(chunk)
def do_GET(self): global LOOP_WAIT_TIME self.send_response(200) # Response headers (multipart) for k, v in pymjpeg.request_headers().items(): self.send_header(k, v) # Multipart content while (True): self.end_headers() self.wfile.write(pymjpeg.boundary) self.end_headers() for k, v in pymjpeg.image_headers(content=self.server.image_data).items(): self.send_header(k,v) self.end_headers() # Write the image data. print "Writing image data" self.wfile.write(self.server.image_data) # Wait... time.sleep(LOOP_WAIT_TIME)
def do_GET(self): self.send_response(200) # Response headers (multipart) for k, v in pymjpeg.request_headers().items(): self.send_header(k, v) # Multipart content filename = '../img/camera0.jpg' while True: # Part boundary string self.end_headers() self.wfile.write(pymjpeg.boundary) self.end_headers() # Part headers for k, v in pymjpeg.image_headers(filename).items(): self.send_header(k, v) self.end_headers() # Part binary for chunk in pymjpeg.image(filename): self.wfile.write(chunk) time.sleep(0.2)
def do_GET(self): global LOOP_WAIT_TIME self.send_response(200) # Response headers (multipart) for k, v in pymjpeg.request_headers().items(): self.send_header(k, v) # Multipart content while (True): self.end_headers() self.wfile.write(pymjpeg.boundary) self.end_headers() for k, v in pymjpeg.image_headers( content=self.server.image_data).items(): self.send_header(k, v) self.end_headers() # Write the image data. print "Writing image data" self.wfile.write(self.server.image_data) # Wait... time.sleep(LOOP_WAIT_TIME)
def do_GET(self): logging.debug('GET response code: 200') self.send_response(200) # Response headers (multipart) for k, v in pymjpeg.request_headers().items(): self.send_header(k, v) logging.debug('GET response header: ' + k + '=' + v) # Multipart content for filename in glob('img/*.jpg'): logging.debug('GET response image: ' + filename) # Part boundary string self.end_headers() self.wfile.write(bytes(pymjpeg.boundary, 'utf-8')) self.end_headers() # Part headers for k, v in pymjpeg.image_headers(filename).items(): self.send_header(k, v) # logging.debug('GET response header: ' + k + '=' + v) self.end_headers() # Part binary # logging.debug('GET response image: ' + filename) for chunk in pymjpeg.image(filename): self.wfile.write(chunk)