Skip to content

Commit

Permalink
Issue #104: Improve performance restore session
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Mar 7, 2022
1 parent c000109 commit f820d0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dirhunt/crawler_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ def add_self_directories(self, exists=None, type_=None):

def start(self):
from dirhunt.processors import get_processor, GenericProcessor, Error, ProcessIndexOfRequest

if self.crawler.closing:
return self
session = self.crawler.sessions.get_session()
try:
with session.get(self.url.url, stream=True, verify=False, timeout=self.timeout,
allow_redirects=False) as resp:
self.set_type(resp.headers.get('Content-Type'))
self.flags.add(str(resp.status_code))

if self.crawler.closing:
return self
text = ''
soup = None
processor = None
Expand Down

0 comments on commit f820d0e

Please sign in to comment.