adding query to fetch a single detailpage
This commit is contained in:
parent
cfd98ed40c
commit
72ff6a7202
2 changed files with 14 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,3 +4,4 @@ venv/
|
|||
__pycache__/
|
||||
sqlite.db
|
||||
.idea/
|
||||
.DS_Store
|
||||
|
|
|
|||
14
rec/query.py
14
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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue