Skip to content

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

@afranck64

Description

@afranck64

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions