I'm using my crawler class in the following manner and I'm beginning to think it's bad practice:
import requests class Crawler(): def __init__(self, url): self.url = url def web_crawler(self): requests.get(self.url) return requests.text
for url in urls: crawler = Crawler(url) results = crawler.web_crawler()
Would it be better to move the
url parameter outside of
__init__ and move it into the
web_crawler function? That way the class won't have to be reinitialized multiple times in main.py.