pax_global_header 0000666 0000000 0000000 00000000064 14042356110 0014506 g ustar 00root root 0000000 0000000 52 comment=18d41565f955028f9fcd2f6cc437f5f1cb717401
woob-18d41565f955028f9fcd2f6cc437f5f1cb717401-modules-entreparticuliers/ 0000775 0000000 0000000 00000000000 14042356110 0024543 5 ustar 00root root 0000000 0000000 woob-18d41565f955028f9fcd2f6cc437f5f1cb717401-modules-entreparticuliers/modules/ 0000775 0000000 0000000 00000000000 14042356110 0026213 5 ustar 00root root 0000000 0000000 woob-18d41565f955028f9fcd2f6cc437f5f1cb717401-modules-entreparticuliers/modules/entreparticuliers/ 0000775 0000000 0000000 00000000000 14042356110 0031757 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000001525 14042356110 0034014 0 ustar 00root root 0000000 0000000 woob-18d41565f955028f9fcd2f6cc437f5f1cb717401-modules-entreparticuliers/modules/entreparticuliers # -*- coding: utf-8 -*-
# Copyright(C) 2015 Bezleputh
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this woob module. If not, see .
from .module import EntreparticuliersModule
__all__ = ['EntreparticuliersModule']
browser.py 0000664 0000000 0000000 00000007062 14042356110 0033742 0 ustar 00root root 0000000 0000000 woob-18d41565f955028f9fcd2f6cc437f5f1cb717401-modules-entreparticuliers/modules/entreparticuliers # -*- coding: utf-8 -*-
# Copyright(C) 2015 Bezleputh
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this woob module. If not, see .
from woob.tools.json import json
from woob.browser import PagesBrowser, URL
from woob.capabilities.base import empty
from .pages import CitiesPage, HousingPage, SearchPage
from .housing import RET, TYPES
class EntreparticuliersBrowser(PagesBrowser):
BASEURL = 'https://api.entreparticuliers.com'
cities = URL('/api/voiture/GetLocalisations/\?term=(?P.*)', CitiesPage)
housing = URL('/api/immo/Getannonce/\?id=(?P<_id>.*)&rubrique=(?P<_rubrique>.*)',
HousingPage)
search_house = URL('/api/immo/GetBiens', SearchPage)
def search_city(self, pattern):
self.update_header()
return self.cities.open(pattern=pattern).iter_cities()
def search_housings(self, query, cities):
self.update_header()
data = {}
data['rubrique'] = TYPES.get(query.type)
data['prix_max'] = query.cost_max or None
data['surface_min'] = query.area_min or None
if len(cities) > 1:
data['rayon'] = None
else:
data['rayon'] = 100
data['CategorieMode'] = None
data['CategorieMaison'] = None
data['Kilometrage'] = None
data['top'] = 50
data['order_by'] = 5
data['sort_order'] = 1
data['lstNbPieces'] = [query.nb_rooms or 0]
data['pageNumber'] = 1
for city in cities:
data['localisation'] = {}
data['localisation']['localisationid'] = city.id
data['localisation']['label'] = city.name
data['localisation']['localisationType'] = 5
data['localisationType'] = 5
data['lstLocalisationId'] = str(city.id)
for house_type in query.house_types:
data['lstTbien'] = RET.get(house_type)
for house in self.search_house.go(data=json.dumps(data)).iter_houses():
if (empty(query.cost_min) or house.cost >= query.cost_min) and \
(empty(query.area_max) or house.area <= query.area_max):
yield house
def get_housing(self, _id, obj=None):
self.reset_header()
_id_ = _id.split('#')
return self.housing.go(_rubrique=_id_[0], _id=_id_[1]).get_housing(obj=obj)
def update_header(self):
self.session.headers.update({"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/json; charset=utf-8",
"Accept": "application/json, text/javascript, */*; q=0.01"})
def reset_header(self):
self.session.headers.update({"Upgrade-Insecure-Requests": "1",
"Content-Type": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"})
favicon.png 0000664 0000000 0000000 00000010733 14042356110 0034037 0 ustar 00root root 0000000 0000000 woob-18d41565f955028f9fcd2f6cc437f5f1cb717401-modules-entreparticuliers/modules/entreparticuliers PNG
IHDR @ @ iq pHYs tIME)&O iTXtComment Created with GIMPd.e bKGD 0 L XDR ?IDATx tǿFjEAv dAPR
AV
!(.,EDMܪ).-6@V1
HB"{'/}|Z99I2ͻw}{ߋe?wp"d0E5A@g |!8xNe!䗄gBHR<0*;D^.(CN_$DP_
"DtG ~
=jH4A J2u@GLp&>b]A=Aq_,xCz