Last active
September 3, 2018 16:17
-
-
Save aahmd/fa3ca1c7acb62ddcf20b9f517ddea414 to your computer and use it in GitHub Desktop.
pass_request_to_new_method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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