Python 2 support (#11)

* consistency of output in python 2

print("string") and print "string" have the same behavior in Python 2 and 3, but print("string", "string") will print a tuple in Python 2

* Add requirement

Update readme to include info on the one required library, requests, including a pip install command.
This commit is contained in:
micsthepick 2019-03-14 23:31:25 +11:00 committed by Michael Pound
parent af78272fdc
commit f2048b7d15
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,11 @@
# pwned-search # pwned-search
Pwned Password API lookup Pwned Password API lookup
- Required libaries:
* requests: `pip install requests`
Usage: Usage:
* `python pwned.py` reads passwords from standard input; * `python pwned.py` reads passwords from standard input;

View File

@ -41,11 +41,11 @@ def main(args):
pwd = pwd.strip() pwd = pwd.strip()
sha1pwd, count = lookup_pwned_api(pwd) sha1pwd, count = lookup_pwned_api(pwd)
if count: if count:
print(pwd, "was found") print("{} was found".format(pwd))
print("Hash {0}, {1} occurrences".format(sha1pwd, count)) print("Hash {0}, {1} occurrences".format(sha1pwd, count))
ec = 1 ec = 1
else: else:
print(pwd, "was not found") print("{} was not found".format(pwd))
return ec return ec