interactionresearchstudio / NaturewatchCameraServer

A Python / OpenCV camera server to stream Pi camera content to a remote client through a website.
https://mynaturewatch.net
GNU General Public License v3.0
103 stars 48 forks source link

Remove elif ladder and use a dictionary map instead #10

Closed frak closed 5 years ago

infinnovation-dev commented 5 years ago

Perhaps neater still would be the pattern:

base, ext = os.path.splitext(self.path)
...
elif ext in self.type_map:
    ....
    self.send_header('Content-type', self.type_map[ext])