This commit is contained in:
parent
576c18b597
commit
bfc27bbb92
@ -144,7 +144,8 @@ You should specify some constraints to filter the resulting housings list,
|
|||||||
under the `constraints` key. The available constraints are:
|
under the `constraints` key. The available constraints are:
|
||||||
|
|
||||||
* `type` is the type of housing you want, either `RENT` (to rent), `SALE` (to
|
* `type` is the type of housing you want, either `RENT` (to rent), `SALE` (to
|
||||||
buy) or `SHARING` (for a shared housing).
|
buy), `SHARING` (for a shared housing), `FURNISHED_RENT` (for a furnished
|
||||||
|
rent), `VIAGER` (for a viager, lifetime sale).
|
||||||
* `house_types` is a list of house types you are looking for. Values can be
|
* `house_types` is a list of house types you are looking for. Values can be
|
||||||
`APART` (flat), `HOUSE`, `PARKING`, `LAND`, `OTHER` (everything else) or
|
`APART` (flat), `HOUSE`, `PARKING`, `LAND`, `OTHER` (everything else) or
|
||||||
`UNKNOWN` (anything which was not matched with one of the previous
|
`UNKNOWN` (anything which was not matched with one of the previous
|
||||||
|
0
doc/_static/.gitkeep
vendored
Normal file
0
doc/_static/.gitkeep
vendored
Normal file
@ -15,6 +15,7 @@ import sys
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import appdirs
|
import appdirs
|
||||||
|
from weboob.capabilities.housing import POSTS_TYPES, HOUSE_TYPES
|
||||||
|
|
||||||
from flatisfy import data
|
from flatisfy import data
|
||||||
from flatisfy import tools
|
from flatisfy import tools
|
||||||
@ -155,7 +156,7 @@ def validate_config(config, check_with_data):
|
|||||||
for constraint in config["constraints"].values():
|
for constraint in config["constraints"].values():
|
||||||
assert "type" in constraint
|
assert "type" in constraint
|
||||||
assert isinstance(constraint["type"], str)
|
assert isinstance(constraint["type"], str)
|
||||||
assert constraint["type"].upper() in ["RENT", "SALE", "SHARING"]
|
assert constraint["type"].upper() in POSTS_TYPES.keys
|
||||||
|
|
||||||
assert "minimum_nb_photos" in constraint
|
assert "minimum_nb_photos" in constraint
|
||||||
if constraint["minimum_nb_photos"]:
|
if constraint["minimum_nb_photos"]:
|
||||||
@ -171,7 +172,7 @@ def validate_config(config, check_with_data):
|
|||||||
assert "house_types" in constraint
|
assert "house_types" in constraint
|
||||||
assert constraint["house_types"]
|
assert constraint["house_types"]
|
||||||
for house_type in constraint["house_types"]:
|
for house_type in constraint["house_types"]:
|
||||||
assert house_type.upper() in ["APART", "HOUSE", "PARKING", "LAND", "OTHER", "UNKNOWN"] # noqa: E501
|
assert house_type.upper() in HOUSE_TYPES.keys
|
||||||
|
|
||||||
assert "postal_codes" in constraint
|
assert "postal_codes" in constraint
|
||||||
assert constraint["postal_codes"]
|
assert constraint["postal_codes"]
|
||||||
|
@ -19,7 +19,7 @@ LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from weboob.capabilities.housing import Query
|
from weboob.capabilities.housing import Query, POSTS_TYPES, HOUSE_TYPES
|
||||||
from weboob.core.bcall import CallErrors
|
from weboob.core.bcall import CallErrors
|
||||||
from weboob.core.ouiboube import WebNip
|
from weboob.core.ouiboube import WebNip
|
||||||
from weboob.tools.json import WeboobEncoder
|
from weboob.tools.json import WeboobEncoder
|
||||||
@ -146,7 +146,7 @@ class WeboobProxy(object):
|
|||||||
try:
|
try:
|
||||||
query.house_types = [
|
query.house_types = [
|
||||||
getattr(
|
getattr(
|
||||||
Query.HOUSE_TYPES,
|
HOUSE_TYPES,
|
||||||
house_type.upper()
|
house_type.upper()
|
||||||
)
|
)
|
||||||
for house_type in constraints_dict["house_types"]
|
for house_type in constraints_dict["house_types"]
|
||||||
@ -157,8 +157,8 @@ class WeboobProxy(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
query.type = getattr(
|
query.type = getattr(
|
||||||
Query,
|
POSTS_TYPES,
|
||||||
"TYPE_{}".format(constraints_dict["type"].upper())
|
constraints_dict["type"].upper()
|
||||||
)
|
)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
LOGGER.error("Invalid post type constraint.")
|
LOGGER.error("Invalid post type constraint.")
|
||||||
@ -227,9 +227,12 @@ class WeboobProxy(object):
|
|||||||
housing = backend.get_housing(flat_id)
|
housing = backend.get_housing(flat_id)
|
||||||
# Otherwise, we miss the @backend afterwards
|
# Otherwise, we miss the @backend afterwards
|
||||||
housing.id = full_flat_id
|
housing.id = full_flat_id
|
||||||
# Eventually clear personal data
|
|
||||||
if not store_personal_data:
|
if not store_personal_data:
|
||||||
|
# Ensure phone is cleared
|
||||||
housing.phone = None
|
housing.phone = None
|
||||||
|
else:
|
||||||
|
# Ensure phone is fetched
|
||||||
|
backend.fillobj(housing, 'phone')
|
||||||
|
|
||||||
return json.dumps(housing, cls=WeboobEncoder)
|
return json.dumps(housing, cls=WeboobEncoder)
|
||||||
except Exception as exc: # pylint: disable=broad-except
|
except Exception as exc: # pylint: disable=broad-except
|
||||||
|
@ -82,7 +82,7 @@ def compare_photos(photo1, photo2, photo_cache, hash_threshold):
|
|||||||
:param photo2: Second photo url.
|
:param photo2: Second photo url.
|
||||||
:param photo_cache: An instance of ``ImageCache`` to use to cache images.
|
:param photo_cache: An instance of ``ImageCache`` to use to cache images.
|
||||||
:param hash_threshold: The hash threshold between two images. Usually two
|
:param hash_threshold: The hash threshold between two images. Usually two
|
||||||
different photos have a hash difference of 30.
|
different photos have a hash difference of 30.
|
||||||
:return: ``True`` if the photos are identical, else ``False``.
|
:return: ``True`` if the photos are identical, else ``False``.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user