# Called for each request that goes through the downloader # middleware.
# Must either: # - return None: continue processing this request # - or return a Response object # - or return a Request object # - or raise IgnoreRequest: process_exception() methods of # installed downloader middleware will be called defprocess_request(self, request, spider): spider.logger.info('Using Proxy') request.meta['proxy'] = 'https://46.10.240.182:55878' returnNone
# Called with the response returned from the downloader.
# Must either; # - return a Response object # - return a Request object # - or raise IgnoreRequest defprocess_response(self, request, response, spider): response.status = 201 return response
# Called when a download handler or a process_request() # (from other downloader middleware) raises an exception.
# Must either: # - return None: continue processing this exception # - return a Response object: stops process_exception() chain # - return a Request object: stops process_exception() chain defprocess_exception(self, request, exception, spider): spider.logger.debug('Get Exception') return request