Skip to content

Commit

Permalink
If only status_code is needed use HEAD instead of GET request to avoi…
Browse files Browse the repository at this point in the history
…d body download
  • Loading branch information
naueramant committed Jan 3, 2019
1 parent de31a31 commit e51da5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Virtual Environment
venv/

# vscode
.vscode/

# Python
__pycache__/

# Jupyter Notebook
.ipynb_checkpoints
*.ipynb
Expand Down
8 changes: 7 additions & 1 deletion sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@ def sherlock(username, verbose=False, tor=False, unique_tor=False):
url = net_info["url"].format(username)
results_site["url_user"] = url

# If only the status_code is needed don't download the body
if net_info["errorType"] == 'status_code':
request_method = session.head
else:
request_method = session.get

# This future starts running the request in a new thread, doesn't block the main thread
future = session.get(url=url, headers=headers)
future = request_method(url=url, headers=headers)

# Store future in data for access later
net_info["request_future"] = future
Expand Down

0 comments on commit e51da5b

Please sign in to comment.