mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
feature/additional-db (#371)
* add support for setting db_url * fix tests * add db_username/password env variables * init db if super user doesn't exist * fix tests * fix tests * set SQLite default DB_URL * don't run tests on draft PRs * add lint/black tests * add test-all * spell check settings * black/flake8 * check format fail * new badges * rename workflow * fix formatting * remove white-space * test connection arguments for pg * format * add new values to template * format * remove old script * monkeypatch test db * working docker-compose for postgres * update docs * test pg workflow * format * add driver * install w/ poetry * setup container * change image * set database to localhost * update tests * set url * fix url path * disable cache * database init * bust cache * get by name Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
52e5e9da5d
commit
c196445e61
33 changed files with 257 additions and 195 deletions
|
@ -1,27 +0,0 @@
|
|||
"""
|
||||
Helper script to download raw recipe data from a URL and dump it to disk.
|
||||
The resulting files can be used as test input data.
|
||||
"""
|
||||
|
||||
import sys, json, pprint
|
||||
import requests
|
||||
import extruct
|
||||
from scrape_schema_recipe import scrape_url
|
||||
from w3lib.html import get_base_url
|
||||
|
||||
for url in sys.argv[1:]:
|
||||
try:
|
||||
data = scrape_url(url)[0]
|
||||
slug = list(filter(None, url.split("/")))[-1]
|
||||
filename = f"{slug}.json"
|
||||
with open(filename, "w") as f:
|
||||
json.dump(data, f, indent=4, default=str)
|
||||
print(f"Saved {filename}")
|
||||
except Exception as e:
|
||||
print(f"Error for {url}: {e}")
|
||||
print("Trying extruct instead")
|
||||
pp = pprint.PrettyPrinter(indent=2)
|
||||
r = requests.get(url)
|
||||
base_url = get_base_url(r.text, r.url)
|
||||
data = extruct.extract(r.text, base_url=base_url)
|
||||
pp.pprint(data)
|
Loading…
Add table
Add a link
Reference in a new issue