def handle(self, *args, **options):
posts = Post.objects.all()
for post in posts:
try:
ref = "{0}{1}/ ".format(settings.DOMAIN, post.slug)
dict = {'referer': ref}
dict.update(HEADERS)
obj = requests.get(post.url, headers=dict)
if obj.status_code == 200:
print((colored.green("OK for: {0}".format(post.url))))
except Exception as e:
print((colored.red("[ERROR]: {0}".format(e))))
self.stdout.write(self.style.SUCCESS('Successfully done parsing jobs'))
评论列表
文章目录