Beispiel #1
0
class Command(BaseCommand):
    help = "Update social media feeds"

    def add_arguments(self, parser):
        parser.add_argument('--cached',
                            action='store_true',
                            dest='cached',
                            default=False,
                            help='Use local cache for HTTP requests')
        parser.add_argument('--type',
                            action='store',
                            dest='type',
                            help='Types of feed to update')
        parser.add_argument('--feed-id',
                            action='store',
                            dest='feed_id',
                            help='Update only single feed')

    def handle(self, *args, **options):
        self.logger = logging.getLogger(__name__)
        if options['cached']:
            import requests_cache
            requests_cache.install_cache("update-social")
        self.updater = FeedUpdater(self.logger)
        update_opts = {}
        if 'type' in options and options['type']:
            update_opts['type'] = options['type'].split(',')
        update_opts['feed_id'] = options.get('feed_id', None)
        self.updater.update_feeds(**update_opts)
Beispiel #2
0
class Command(BaseCommand):
    help = "Update social media feeds"

    def handle(self, *args, **options):
        import requests_cache
        requests_cache.configure("update-social")
        self.logger = logging.getLogger(__name__)
        self.updater = FeedUpdater(self.logger)
        self.updater.update_feeds()
Beispiel #3
0
class Command(BaseCommand):
    help = "Update social media feeds"

    def handle(self, *args, **options):
        import requests_cache
        requests_cache.configure("update-social")
        self.logger = logging.getLogger(__name__)
        self.updater = FeedUpdater(self.logger)
        self.updater.update_feeds()
Beispiel #4
0
class Command(BaseCommand):
    help = "Update social media feeds"
    option_list = BaseCommand.option_list + (
        make_option('--cached', action='store_true', dest='cached', default=False,
            help='Use local cache for HTTP requests'),
    )

    def handle(self, *args, **options):
        self.logger = logging.getLogger(__name__)
        if options['cached']:
            import requests_cache
            requests_cache.install_cache("update-social")
        self.updater = FeedUpdater(self.logger)
        self.updater.update_feeds()
Beispiel #5
0
class Command(BaseCommand):
    help = "Update social media feeds"
    option_list = BaseCommand.option_list + (
        make_option('--cached', action='store_true', dest='cached', default=False,
            help='Use local cache for HTTP requests'),
        make_option('--type', action='store', dest='type', help='Types of feed to update'),
    )

    def handle(self, *args, **options):
        self.logger = logging.getLogger(__name__)
        if options['cached']:
            import requests_cache
            requests_cache.install_cache("update-social")
        self.updater = FeedUpdater(self.logger)
        update_opts = {}
        if 'type' in options and options['type']:
            update_opts['type'] = options['type'].split(',')
        self.updater.update_feeds(**update_opts)
Beispiel #6
0
 def run(self, **kwargs):
     logger = self.get_logger()
     updater = FeedUpdater(logger)
     print "Updating feeds"
     updater.update_feeds()
     print "Feed update done"
Beispiel #7
0
 def run(self, **kwargs):
     logger = self.get_logger()
     updater = FeedUpdater(logger)
     print("Updating feeds")
     updater.update_feeds()
     print("Feed update done")