home.co.uk scraping
This commit is contained in:
parent
74d6dd7bf8
commit
f3e3c1ee49
6 changed files with 538 additions and 28 deletions
|
|
@ -8,6 +8,7 @@ from flask import Flask, Response, jsonify, send_from_directory
|
|||
from prometheus_client import generate_latest, CONTENT_TYPE_LATEST
|
||||
|
||||
from constants import DATA_DIR, RUN_ON_STARTUP, SCHEDULE_HOUR
|
||||
from homecouk import load_cookies as load_homecouk_cookies
|
||||
from rightmove import outcode_cache
|
||||
from scraper import (
|
||||
_sync_gauges,
|
||||
|
|
@ -122,6 +123,10 @@ def get_status():
|
|||
"outcodes_total": status.outcodes_total,
|
||||
"properties_buy": status.properties_buy,
|
||||
"properties_rent": status.properties_rent,
|
||||
"properties_by_source": {
|
||||
"rightmove": status.rm_properties,
|
||||
"homecouk": status.hk_properties,
|
||||
},
|
||||
"errors": status.errors[-20:], # last 20 errors
|
||||
"elapsed_seconds": round(elapsed, 1),
|
||||
}
|
||||
|
|
@ -132,9 +137,11 @@ def get_status():
|
|||
|
||||
@app.route("/debug")
|
||||
def get_debug():
|
||||
hk_cookies = load_homecouk_cookies()
|
||||
return jsonify({
|
||||
"outcode_cache_size": len(outcode_cache),
|
||||
"outcode_cache_sample": dict(list(outcode_cache.items())[:20]),
|
||||
"homecouk_enabled": hk_cookies is not None,
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue