def __repair_times_request_from_options(self, item): url = '/vehicle/component/repair-times/variant' url = 'https://' + self.allowed_domains[0] + url request = FormRequest( url = url, formdata = {'item_id': item['item_id']} ) request.headers['Content-Type'] = 'application/x-www-form-urlencoded' request.headers['Accept'] = '*/*' request.headers['X-Requested-With'] = 'XMLHttpRequest' request.method = 'POST' request.dont_filter = True request.meta['option'] = item request.callback = self.going_to_repair_times self.__prepare_request(request) return request
def __engine_codes_request(self, series): url = 'https://' + self.allowed_domains[0] + '/v2/engine_code/selection' request = FormRequest( url = url, formdata = { 'manufacturer': series['link'], 'body': series['model_family_id'], 'litres': series['litres'], 'fuel': series['fuel'], 'freetext': series['text'], 'vehicletype': series['vehicletype'], 'module': 'RT' }, callback = self.parse_engine_codes, meta = { 'series': series, }, dont_filter = True ) self.__prepare_request(request) request.method = 'POST' return request
def __options_request(self, code): url = 'https://workshop.autodata-group.com/engine-code-form-api' request = FormRequest( url = url, callback = self.going_to_options_or_repair_times, formdata = { 'vehicle_id': code['mecnid'], 'engine_id': code['code'], 'engine_name': code['code'], 'back': ',/vehicle/component/rt&module=RT', }, meta = { 'series': code, }, dont_filter = True ) self.__prepare_request(request) request.method = 'POST' request.headers['Content-Type'] = 'application/x-www-form-urlencoded' request.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' request.headers['X-Requested-With'] = 'XMLHttpRequest' request.meta['code'] = code return request