I need to set the referer url, before scraping a site, the site uses refering url based Authentication, so it does not allow me to login if the referer is not valid.
Just set Referer url in the Request headers
class scrapy.http.Request(url[, method='GET', body, headers, ...
headers (dict) – the headers of this request. The dict values can be strings (for single valued headers) or lists (for multi-valued headers).
Example:
return Request(url=your_url,
headers={'Referer':'http://your_referer_url'})