Skip to content

Commit

Permalink
Issue #105: Use "with" with requests connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Apr 20, 2022
1 parent f820d0e commit 0563d82
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
6 changes: 0 additions & 6 deletions dirhunt/sources/commoncrawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ def callback(self, domain):
if not latest_crawl_index:
return
session = Sessions().get_session()
response = session.get(
latest_crawl_index,
params={'url': '*.{}'.format(domain), 'output': 'json'},
timeout=TIMEOUT,
stream=True
)
try:
with session.get(latest_crawl_index, params={'url': '*.{}'.format(domain), 'output': 'json'},
timeout=TIMEOUT, stream=True) as response:
Expand Down
1 change: 1 addition & 0 deletions dirhunt/sources/wayback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'limit': '10000'
}
DEFAULT_ENCODING = 'utf-8'
TIMEOUT = 10


class Wayback(Source):
Expand Down

0 comments on commit 0563d82

Please sign in to comment.