Skip to content

Instantly share code, notes, and snippets.

@aahmd
Last active September 3, 2018 16:17
Show Gist options
  • Save aahmd/fa3ca1c7acb62ddcf20b9f517ddea414 to your computer and use it in GitHub Desktop.
Save aahmd/fa3ca1c7acb62ddcf20b9f517ddea414 to your computer and use it in GitHub Desktop.
pass_request_to_new_method
from scrapy.http import Request
def parse_final_page(self, response):
# do scraping here:
def get_next_page(self, response, url_append):
new_url = response.url + url_append
req = Request(
url=new_url,
callback=self.parse_final_page,
)
yield req
def parse(self, response):
url_append = i.css('item_to_add_to_url')
yield from self.get_next_page(response, url_append)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment