Skip to content

RESTful API with Flask that serves images from Raspberry Pi picamera

License

Notifications You must be signed in to change notification settings

bnorville/WatcherEye

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WatcherEye

License: GPL v3 Build Status codecov Codacy Badge

RESTful API with Flask that serves images from Raspberry Pi powered by picamera.

Setup

This software is tested in the following environment:

  1. Raspberry Pi 3 Model B v1.2
  2. Picamera vX.Y

Installation

All dependencies are specified in requirements.txt. Install all python packages:

pip install -r requirements.txt

Running

  1. If using virtualenvwrapper: workon WatcherEye
  2. Set Flask app environment variable: export FLASK_APP=watchereye
  3. Set Flask app development variable:export FLASK_ENV=info
  4. Start the Flask server: flask run
  5. Point your favorite browser to localhost:5000

The API can be accessed via HTTP/S requests, see watchereye/api.pyfor up-to-date API endpoint documentation. Briefly:

Method Endpoint Description Return Format
GET /api/v1/ping Ping API server JSON array
GET /api/v1/stats Usage statistics JSON array
GET /api/v1/image Capture and return image image/jpeg
GET /api/v1/stream View video stream multipart/x-mixed-replace; image/jpeg

Logging

Logging at the debug level (recording all incoming requests and IPs) using the default python logging facility. Logs are stored in logs/log.log and streamed to STDOUT

Test

Using PyTest:

  1. workon WatcherEye
  2. python -m pytest -s -v --disable-pytest-warnings tests/

References

  1. Installing Raspbian on Raspberry Pi on Mac OS X
  2. Video Streaming with Flask
  3. Flask Video Streaming Revisited

Development Notes

Update requirements.txt after installing any new pip modules using: pip freeze > requirements.txt

About

RESTful API with Flask that serves images from Raspberry Pi picamera

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.4%
  • Roff 20.5%
  • HTML 2.1%