All good
This commit is contained in:
parent
6ea544a0f6
commit
6cc7288126
45 changed files with 929 additions and 1043 deletions
|
|
@ -5,10 +5,10 @@ import tempfile
|
|||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from constants import DATA_DIR
|
||||
from constants import DATA_DIR, REPO_DIR
|
||||
|
||||
|
||||
SOURCE_CHOICES = ("rightmove", "homecouk", "zoopla", "all")
|
||||
SOURCE_CHOICES = ("rightmove", "zoopla", "all")
|
||||
TEST_MAX_PROPERTIES_PER_SOURCE = 100
|
||||
TEST_OUTCODES = (
|
||||
"E1",
|
||||
|
|
@ -28,14 +28,16 @@ log = logging.getLogger("finder")
|
|||
|
||||
def configure_standalone_runtime() -> None:
|
||||
"""Keep browser/cache/temp files on the project volume for local runs."""
|
||||
runtime_dir = DATA_DIR / ".runtime"
|
||||
runtime_dir = REPO_DIR / ".tmp" / "finder"
|
||||
cache_dir = runtime_dir / "cache"
|
||||
temp_dir = runtime_dir / "tmp"
|
||||
cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
temp_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
os.environ.setdefault("XDG_CACHE_HOME", str(cache_dir))
|
||||
os.environ.setdefault("TMPDIR", str(temp_dir))
|
||||
os.environ["XDG_CACHE_HOME"] = str(cache_dir)
|
||||
os.environ["TMPDIR"] = str(temp_dir)
|
||||
os.environ["TEMP"] = str(temp_dir)
|
||||
os.environ["TMP"] = str(temp_dir)
|
||||
tempfile.tempdir = str(temp_dir)
|
||||
|
||||
|
||||
|
|
@ -47,7 +49,7 @@ def parse_args() -> argparse.Namespace:
|
|||
"--source",
|
||||
choices=SOURCE_CHOICES,
|
||||
default="all",
|
||||
help="Portal to scrape. 'all' runs Rightmove, home.co.uk, and Zoopla.",
|
||||
help="Portal to scrape. 'all' runs Rightmove and Zoopla.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output-dir",
|
||||
|
|
@ -89,7 +91,7 @@ def configure_logging() -> None:
|
|||
|
||||
def selected_sources(source: str) -> list[str]:
|
||||
if source == "all":
|
||||
return ["rightmove", "homecouk", "zoopla"]
|
||||
return ["rightmove", "zoopla"]
|
||||
return [source]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue