Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- '''
- Test version
- '''
- from flask import Flask
- from datetime import datetime
- import io
- import time
- import picamera
- import logging
- import sys
- import os
- app = Flask(__name__)
- logging.basicConfig(level=logging.INFO,
- format='%(asctime)s %(levelname)-8s '
- + '[%(filename)s:%(lineno)s:%(funcName)s()] %(message)s',
- datefmt='%Y-%m-%d %H:%M:%S')
- @app.route("/start", methods=['POST'])
- def start_capture():
- with picamera.PiCamera() as camera:
- camera.resolution = (1920, 1080)
- camera.start_preview()
- time.sleep(300)
- pass
- @app.route("/stop", method=['POST'])
- def stop_capture():
- with picamera.PiCamera() as camera:
- camera.stop_preview()
- pass
- @app.route("/screenshot", methods=['POST'])
- def screenshot():
- with picamera.PiCamera() as camera:
- camera.capture('foo.jpg', use_video_port=True)
- pass
- if __name__ == "__main__":
- app.run(host='192.168.0.198', port='8080')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement