[leboncoin] allow to choose between owner adverts and agency adverts
This commit is contained in:
parent
695d969682
commit
fd5c565b3b
2 changed files with 10 additions and 5 deletions
|
|
@ -25,7 +25,7 @@ from .pages import CityListPage, HousingListPage, HousingPage
|
|||
class LeboncoinBrowser(PagesBrowser):
|
||||
BASEURL = 'http://www.leboncoin.fr'
|
||||
city = URL('ajax/location_list.html\?city=(?P<city>.*)&zipcode=(?P<zip>.*)', CityListPage)
|
||||
search = URL('(?P<type>.*)/offres/ile_de_france/occasions/\?ps=(?P<ps>.*)&pe=(?P<pe>.*)&ros=(?P<ros>.*)&location=(?P<location>.*)&sqs=(?P<sqs>.*)&sqe=(?P<sqe>.*)&ret=(?P<ret>.*)',
|
||||
search = URL('(?P<type>.*)/offres/ile_de_france/occasions/\?ps=(?P<ps>.*)&pe=(?P<pe>.*)&ros=(?P<ros>.*)&location=(?P<location>.*)&sqs=(?P<sqs>.*)&sqe=(?P<sqe>.*)&ret=(?P<ret>.*)&f=(?P<advert_type>.*)',
|
||||
'(ventes_immobilieres|locations)/offres/ile_de_france/occasions/\?.*',
|
||||
HousingListPage)
|
||||
housing = URL('ventes_immobilieres/(?P<_id>.*).htm', HousingPage)
|
||||
|
|
@ -40,7 +40,7 @@ class LeboncoinBrowser(PagesBrowser):
|
|||
|
||||
return self.city.go(city=city, zip=zip_code).get_cities()
|
||||
|
||||
def search_housings(self, type, cities, nb_rooms, area_min, area_max, cost_min, cost_max, ret):
|
||||
def search_housings(self, type, cities, nb_rooms, area_min, area_max, cost_min, cost_max, ret, advert_type):
|
||||
return self.search.go(location=cities,
|
||||
ros=nb_rooms,
|
||||
sqs=area_min,
|
||||
|
|
@ -48,6 +48,7 @@ class LeboncoinBrowser(PagesBrowser):
|
|||
ps=cost_min,
|
||||
pe=cost_max,
|
||||
type=type,
|
||||
advert_type=advert_type,
|
||||
ret=ret).get_housing_list()
|
||||
|
||||
def get_housing(self, _id):
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from weboob.tools.backend import Module
|
||||
from weboob.tools.backend import Module, BackendConfig
|
||||
from weboob.capabilities.housing import CapHousing, Query, Housing, HousingPhoto
|
||||
|
||||
from weboob.tools.value import Value
|
||||
from .browser import LeboncoinBrowser
|
||||
|
||||
|
||||
|
|
@ -37,6 +37,9 @@ class LeboncoinModule(Module, CapHousing):
|
|||
|
||||
BROWSER = LeboncoinBrowser
|
||||
|
||||
CONFIG = BackendConfig(Value('advert_type', label='Advert type',
|
||||
choices={'c': 'Agency', 'p': 'Owner', 'a': 'All'}, default='a'))
|
||||
|
||||
RET = {Query.HOUSE_TYPES.HOUSE: '1',
|
||||
Query.HOUSE_TYPES.APART: '2',
|
||||
Query.HOUSE_TYPES.LAND: '3',
|
||||
|
|
@ -85,6 +88,7 @@ class LeboncoinModule(Module, CapHousing):
|
|||
|
||||
return self.browser.search_housings(_type, ','.join(cities), nb_rooms,
|
||||
area_min, area_max,
|
||||
cost_min, cost_max, '&ret='.join(ret))
|
||||
cost_min, cost_max, '&ret='.join(ret),
|
||||
self.config['advert_type'].get())
|
||||
|
||||
OBJECTS = {Housing: fill_housing, HousingPhoto: fill_photo}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue