py-linkedin-jobs-scraper icon indicating copy to clipboard operation
py-linkedin-jobs-scraper copied to clipboard

Refactored callback validation to use callable() for broader compatibility.

Open daniilpastukhov opened this issue 1 year ago • 1 comments

At the moment, LinkedinScraper.on method doesn't allow class methods to be passed as a callback. Example:

class A:
    def __init__(self):
        self.scraper = LinkedinScraper(...)
        self.scraper.on(..., self.callback)

     def callback(self):
          ...

This code fails with ValueError: Callback must be a function.

This PR proposes utilising Python's callable method instead of checking whether callback is an instance of FunctionType.

daniilpastukhov avatar Feb 03 '24 14:02 daniilpastukhov