zorg_network_camera/adaptor.py
def has_changed(self):
        """
        Method to check if an image has changed
        since it was last downloaded. By making
        a head request, this check can be done
        quicker that downloading and processing
        the whole file.
        """
        request = urllib_request.Request(self.url)
        request.get_method = lambda: 'HEAD'

        response = urllib_request.urlopen(request)
        information = response.info()

        if 'Last-Modified' in information:
            last_modified = information['Last-Modified']

            # Return False if the image has not been modified
            if last_modified == self.image_last_modified:
                return False

        self.image_last_modified = last_modified

        # Return True if the image has been modified
        # or if the image has no last-modified header
        return True
def has_changed(self):
        request = urllib_request.Request(self.url)
        request.get_method = lambda: 'HEAD'

        response = urllib_request.urlopen(request)
        information = response.info()

        if 'Last-Modified' in information:
            last_modified = information['Last-Modified']

            # Return False if the image has not been modified
            if last_modified == self.image_last_modified:
                return False

        self.image_last_modified = last_modified

        # Return True if the image has been modified
        # or if the image has no last-modified header
        return True
def has_changed ( self ) : request = urllib_request . Request ( self . url ) request . get_method = lambda : 'HEAD' response = urllib_request . urlopen ( request ) information = response . info ( ) if 'Last-Modified' in information : last_modified = information [ 'Last-Modified' ] # Return False if the image has not been modified if last_modified == self . image_last_modified : return False self . image_last_modified = last_modified # Return True if the image has been modified # or if the image has no last-modified header return True
Method to check if an image has changed
        since it was last downloaded. By making
        a head request, this check can be done
        quicker that downloading and processing
        the whole file.
Method to check if an image has changed since it was last downloaded . By making a head request this check can be done quicker that downloading and processing the whole file .