-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
60 lines (52 loc) · 1.63 KB
/
Copy pathmodels.py
File metadata and controls
60 lines (52 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""Data models for Logic-Immo scraper."""
from dataclasses import dataclass, field, asdict
from datetime import datetime
from typing import Optional
@dataclass
class Property:
"""Represents a property listing from Logic-Immo."""
url: str = ""
listing_id: str = ""
reference: str = ""
title: str = ""
property_type: str = ""
contract_type: str = ""
price: Optional[int] = None
price_per_sqm: Optional[float] = None
city: str = ""
district: str = ""
postal_code: str = ""
full_address: str = ""
rooms: Optional[int] = None
bedrooms: Optional[int] = None
bathrooms: Optional[int] = None
living_area: Optional[float] = None
floor: str = ""
has_elevator: Optional[bool] = None
has_parking: Optional[bool] = None
has_cellar: Optional[bool] = None
has_balcony: Optional[bool] = None
has_terrace: Optional[bool] = None
has_garden: Optional[bool] = None
is_furnished: Optional[bool] = None
energy_rating: str = ""
ges_rating: str = ""
year_built: str = ""
description: str = ""
agency_name: str = ""
agent_name: str = ""
agency_address: str = ""
is_new: bool = False
is_exclusive: bool = False
published_date: str = ""
date_scraped: str = field(default_factory=lambda: datetime.now().isoformat())
def to_dict(self) -> dict:
"""Convert property to dictionary."""
return asdict(self)
@dataclass
class SearchResult:
"""Represents search results from a listing page."""
total_count: int = 0
properties: list = field(default_factory=list)
current_page: int = 1
has_next_page: bool = False