python – Processing images without downloading using Scrapy Spiders


I'm trying to use a Scrapy Spider to solve a problem (a programming question from HackThisSite):

(1) I have to log in to a website, giving a username and a password (already done)
(2) After that, I have to access an image with a specific URL (the image is only accessible to registered users)
(3) Then, without downloading the image, I have to read its pixels and execute a function on the information
(4) And the result of the function will fill a form and send the data to the server of the website (I already know how to do this step)

So, I can ask again: would it be possible (using a spider) to read an image accessible only to registered users and process it in the spider code?

I tried to investigate different methods, using lines of elements is not a good method (I do not want to download the file).

The code that I already have is:

ProgrammingQuestion2 class (Spider):

name = & # 39; p2 & # 39;
start_urls = ['https://www.hackthissite.org/']

    def parse (auto, answer):

formdata_hts = {& # 39; username & # 39 ;: ,
& # 39; password & # 39 ;: ,
& # 39; btn_submit & # 39 ;: & # 39; Login & # 39;}

returns FormRequest.from_response (answer,
formdata = formdata_hts, callback = self.redirect_to_page)

def redirect_to_page (auto, reply):

Performance request (url = & # 39; https: //www.hackthissite.org/missions/prog/2/&#39 ;,
callback = self.solve_question_2)

def solve_question_2 (auto, answer):

open_in_browser (answer)
img_url = & # 39; https: //www.hackthissite.org/missions/prog/2/PNG'
# What can I do here?

I hope to solve this problem using the functions of Scrapy, otherwise it would be necessary to log into the website (sending the form data) again.