def process_url(self, urldata, output_dir, call_completion_func=False,
                    completion_extra_prms=None, start_time=0):
        error_occurred = False
        try:
            output_fn = os.path.join(output_dir, self._filename_from_urldata(urldata))
            self._download_image(urldata['url'], output_fn)
            clean_fn, thumb_fn = self.process_image(output_fn)
        except urllib2.URLError, e:
            log.info('URL Error for %s (%s)', urldata['url'], str(e))
            error_occurred = True
        except urllib2.HTTPError, e:
            if e.code != 201:
                log.info('HTTP Error for %s (%s)', urldata['url'], str(e))
                error_occurred = True
        except BadStatusLine, e:
            log.info('Bad status line for %s (%s)', urldata['url'], str(e))
            error_occurred = True
        except __HOLE__, e:
            log.info('IO Error for: %s (%s)', urldata['url'], str(e))
            error_occurred = True
        except FilterException, e:
            log.info('Filtered out: %s (%s)', urldata['url'], str(e))
            error_occurred = True

        if not error_occurred:
            out_dict = urldata
            out_dict['orig_fn'] = output_fn
            out_dict['clean_fn'] = clean_fn
            out_dict['thumb_fn'] = thumb_fn
            if start_time > 0:
                out_dict['download_time'] = time.time() - start_time

            if call_completion_func:
                # use callback handler to run completion func configured in process_urls
                if completion_extra_prms:
                    self._callback_handler.run_callback(out_dict, completion_extra_prms, blocking=True)
                else:
                    self._callback_handler.run_callback(out_dict, blocking=True)

            log.info('done with callback')
            return out_dict
        else:
            if call_completion_func:
                # indicate to callback handler that a URL to be processed failed
                self._callback_handler.skip()

            return None
dataset/ETHPy150Open kencoken/imsearch-tools/imsearchtools/process/image_getter.py/ImageGetter.process_url