How to use on_message? in pyspider

url
on_messagemsgon_message
print msg,message
   

clipboard.png

def detail_page(self, response):
    results = json.loads(response.text)
    for result in results:
        date = result["date"]
        number = response.url[6:]
        self.send_message(self.project_name, {
            "number": number,
            "date":date,
         }, url="%s-sharp%s" % (response.url, date))
 
def on_message(self, project, msg):
    print msg
    return msg
Nov.19,2021

I don't know how to design it, and on_message will not be called during testing.
but changing the project to the running runtime is called
if it doesn't work, it shouldn't be the problem with this code.

Menu