Skip to content

Commit

Permalink
Replaced requests with urllib to not require external dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Sindastra <git@sindastra.net>
  • Loading branch information
sindastra committed Jan 27, 2024
1 parent ba27f92 commit 0210dcc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions passwnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sys
from sys import exit # This is for pyinstaller to work
from hashlib import sha1
import requests
import urllib.request
import os
import platform

Expand Down Expand Up @@ -54,12 +54,12 @@
print(F'Submitting hash prefix: {HASH_PREFIX}...')

APIURL = 'https://api.pwnedpasswords.com/range/'
REQUEST = requests.get(APIURL + HASH_PREFIX)
REQUEST = urllib.request.urlopen(APIURL + HASH_PREFIX)

if REQUEST.status_code != 200:
if REQUEST.status != 200:
exit('Unexpected server response.')

RESPONSE = REQUEST.text.strip()
RESPONSE = REQUEST.read().decode()
RESULTS = RESPONSE.split()

print(F'Got {len(RESULTS)} hashes... Searching...')
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
requests

0 comments on commit 0210dcc

Please sign in to comment.