mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-19 15:33:45 +02:00
fix wikipedia fetch
This commit is contained in:
parent
188c566eae
commit
e2e214449d
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
import time
|
import time
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from acros.models import WikipediaLink
|
from acros.models import WikipediaLink
|
||||||
|
|
||||||
|
@ -11,10 +13,12 @@ class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
links = WikipediaLink.objects.all()
|
links = WikipediaLink.objects.all()
|
||||||
for link in links:
|
for link in links:
|
||||||
print(link)
|
|
||||||
self.stdout.write(link.title)
|
self.stdout.write(link.title)
|
||||||
|
if link.timestamp >= (timezone.now() - timedelta(days=180)):
|
||||||
|
print("skipped")
|
||||||
|
continue
|
||||||
link.fetched = False
|
link.fetched = False
|
||||||
# update_change_reason(link, "refetch_wikipedia command")
|
# update_change_reason(link, "refetch_wikipedia command")
|
||||||
link.clean()
|
link.clean()
|
||||||
link.save()
|
link.save()
|
||||||
time.sleep(1)
|
time.sleep(3)
|
||||||
|
|
Loading…
Reference in a new issue