class MySpider(...):
user_agent = 'foo/1.0'
...
Also you can roll your own user-agent middleware to customize the
value across all spiders.
If you want to dynamically set the user-agent in your spider you just
need to set the
request header.
def parse(...):
req = Request(...)
req.headers["User-Agent"] = self.get_random_ua()
...
Regards,
~Rolando
> --
> You received this message because you are subscribed to the Google Groups "scrapy-users" group.
> To post to this group, send email to scrapy...@googlegroups.com.
> To unsubscribe from this group, send email to scrapy-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/scrapy-users?hl=en.
>