diff --git a/.gitignore b/.gitignore index 5197b12..c665ac1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ venv/ __pycache__/ sqlite.db .idea/ +.DS_Store diff --git a/rec/query.py b/rec/query.py index ddf6f98..4b2c8db 100644 --- a/rec/query.py +++ b/rec/query.py @@ -11,7 +11,6 @@ urllib3.disable_warnings() cache = Cache(r"_cache") - headers = { "Host": "api.rightmove.co.uk", # 'Accept-Encoding': 'gzip, deflate, br', @@ -20,6 +19,19 @@ headers = { } +def detail_query(detail_id: int): + params = { + 'apiApplication': 'ANDROID', + 'appVersion': '3.70.0', + } + url = f'https://api.rightmove.co.uk/api/property/{detail_id}' + response = requests.get(url, params=params, headers=headers, verify=False) + if response.status_code != 200: + raise Exception("Failed due to: ", response.text) + + return response.json() + + @cache.memoize() def listing_query(page: int, min_bedrooms: int, max_bedrooms: int, radius: float, min_price: int, max_price: int): print("Querying")