adding musthave and lastXdays
This commit is contained in:
parent
36258d877f
commit
a9b8d4d630
3 changed files with 9 additions and 18 deletions
|
|
@ -16,6 +16,7 @@ params = {
|
||||||
'sortBy': 'distance',
|
'sortBy': 'distance',
|
||||||
'includeUnavailableProperties': 'false',
|
'includeUnavailableProperties': 'false',
|
||||||
'propertyTypes': 'flat',
|
'propertyTypes': 'flat',
|
||||||
|
'mustHave': 'newHome', # added manually later
|
||||||
'dontShow': 'sharedOwnership,retirement',
|
'dontShow': 'sharedOwnership,retirement',
|
||||||
'minPrice': '150000',
|
'minPrice': '150000',
|
||||||
'maxPrice': '500000',
|
'maxPrice': '500000',
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
|
|
||||||
def nextMonday():
|
|
||||||
"""
|
|
||||||
I think this function doesnt work when the day is monday itself.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
_type_: _description_
|
|
||||||
"""
|
|
||||||
now = datetime.now(timezone.utc)
|
|
||||||
days_until_monday = (0 - now.weekday() + 7) % 7
|
|
||||||
monday = now + timedelta(days=days_until_monday)
|
|
||||||
monday_9am = monday.replace(hour=9, minute=0, second=0, microsecond=0, tzinfo=timezone.utc)
|
|
||||||
return monday_9am
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
print(nextMonday())
|
|
||||||
|
|
@ -30,7 +30,7 @@ def detail_query(detail_id: int):
|
||||||
|
|
||||||
|
|
||||||
# @cache.memoize()
|
# @cache.memoize()
|
||||||
def listing_query(page: int, min_bedrooms: int, max_bedrooms: int, radius: float, min_price: int, max_price: int) -> dict:
|
def listing_query(page: int, min_bedrooms: int, max_bedrooms: int, radius: float, min_price: int, max_price: int, mustNewHome: bool = False, max_days_since_added: int = None) -> dict:
|
||||||
params = {
|
params = {
|
||||||
"locationIdentifier": "POSTCODE^4228216",
|
"locationIdentifier": "POSTCODE^4228216",
|
||||||
"channel": "BUY",
|
"channel": "BUY",
|
||||||
|
|
@ -48,6 +48,13 @@ def listing_query(page: int, min_bedrooms: int, max_bedrooms: int, radius: float
|
||||||
"apiApplication": "ANDROID",
|
"apiApplication": "ANDROID",
|
||||||
"appVersion": "3.70.0",
|
"appVersion": "3.70.0",
|
||||||
}
|
}
|
||||||
|
if max_days_since_added:
|
||||||
|
if max_days_since_added not in [1,3,7,14]:
|
||||||
|
raise Exception("Invalid max days. Can only be", [1,3,7,14])
|
||||||
|
params['maxDaysSinceAdded'] = max_days_since_added
|
||||||
|
|
||||||
|
if mustNewHome:
|
||||||
|
params['mustHave'] = 'newHome'
|
||||||
|
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://api.rightmove.co.uk/api/property-listing",
|
"https://api.rightmove.co.uk/api/property-listing",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue