From 5cab689180436fb430f0526ff42ad6ba9f12c483 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 13 Mar 2023 17:35:21 +0100 Subject: Add visit_site script to force CACHE update --- home/templates/home/home_page.html | 2 +- scripts/visit_site.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 scripts/visit_site.py diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html index b51869a..a41be36 100644 --- a/home/templates/home/home_page.html +++ b/home/templates/home/home_page.html @@ -38,7 +38,7 @@

{{subpage.title}}

{{ subpage.showcase.body|richtext }}
- {% trans "Browse..." %} + {% trans "Browse..." %}
{% endfor %} diff --git a/scripts/visit_site.py b/scripts/visit_site.py new file mode 100755 index 0000000..abd6a21 --- /dev/null +++ b/scripts/visit_site.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +from bs4 import BeautifulSoup +import requests + + +def main(url): + if not url.startswith("http"): + url = "http://" + url + if not url.endswith("/"): + url += "/" + response = requests.get(url) + soup = BeautifulSoup(response.text, "html.parser") + for link in soup.find_all("a", "link-browse"): + href = link["href"] + try: + requests.get(url + href) + except Exception: + pass + + +if __name__ == '__main__': + from pergamon.settings.local import BASE_URL + main(BASE_URL) \ No newline at end of file -- cgit v1.2.3