Commit Graph

14 Commits

Author SHA1 Message Date
Alex Povel
36b6f603b4 Two tiny changes (#27)
* Use .ok property instead of status-code check against 200

* Tighter try/except handling\nPutting less code into the try block
2019-07-24 20:40:03 +01:00
Michael Pound
8efd8ffedd
Python 2 and 3 compatible shebang 2019-03-14 20:18:04 +00:00
Jonathan
5aeb5c581e Add shebang (#12) 2019-03-14 14:35:42 +00:00
Toon
3279ad4dd5 Better error handling and output format (#6)
* Update readme: fix small redirection mistake

* Use one output line per password

* More graceful error handling

* Only catch UnicodeErrors
2019-03-14 14:33:15 +00:00
micsthepick
f2048b7d15 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.
2019-03-14 12:31:25 +00:00
d-chris
112748240d
changed password encoding to utf-8 for sha-1
according to api
https://haveibeenpwned.com/API/v2#PwnedPasswords
2019-03-14 11:50:17 +01:00
Michal Nazarewicz
9e515019be Simplify and document lookup_pwned_api interface
Always return a pair from the lookup_pwned_api so that destructuring
assignment can be safely used when calling the function.  The second
argument being zero indicates the password has not been found in the
pwend database.

While at it, document the function.
2019-03-13 01:38:33 +00:00
Michal Nazarewicz
f252886b95 Handle non-200 status codes explicitly 2019-03-13 01:38:33 +00:00
Michal Nazarewicz
6955575a64 Vary exit status based on whether leaked password was found 2019-03-13 01:38:05 +00:00
Michal Nazarewicz
068f0832f7 Support reading passwords from standard input 2019-03-13 01:37:42 +00:00
Michal Nazarewicz
366b730905 Support checking multiple passwords with a single invocation 2019-03-13 01:27:05 +00:00
Michal Nazarewicz
df6a0f1007 Add ‘__name__ == __main__’ guard so the file can be imported 2019-03-13 01:26:20 +00:00
Michal Nazarewicz
19fd5102cb Remove unnecessary dependency on pyca
Python’s built-in hashlib is capable of calculating SHA1.  There’s
no need to depend on a third party library which may or may not be
available.
2019-03-13 00:39:52 +00:00
Michael Pound
80f2da2f03 Code added 2019-03-12 21:41:07 +00:00