Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package usability: same response type should be used for pwned and not pwned ressources #5

Open
afranck64 opened this issue Jul 24, 2017 · 0 comments

Comments

@afranck64
Copy link

Instead of setting HIBP.response to a string ("object has not been pwned.") for not pwned ressources, the awaited type should be used.
If response is meant to be an [json]object: HIBP.response should be None.
If response is meant to be a list/array: HIBP.response should be an empty list.
The user of the module would then be able to easily check for existence of HIBP.response for further processing, instead of testing it against a string ("object has not been pwned.") or applying a type test.

for hibp_obj in hibp_objs:
    if hibp_obj.response:
        #do something amazing with the response
#or
pwneds = [hibp_obj for hibp_obj in hibp_objs if hibp_obj.response]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant