Skip to main content

A Python interface to the Have I Been Pwned API

Project description

# Have I Been Pwned?

Python interface to Have I Been Pwned API

## What is Have I Been Pwned?

[Have I Been Pwned]( is a free resource to quickly assess if an account or domain has been compromised or “pwned” in a data breach. By aggregating the data here the project helps victims be aware of account compromises, and highlights the severity of the risks of Internet-wide attacks. For more information on who, what, and why, click [here](

## Dependencies

` requests gevent `

## Setup

This library runs on Python3.x+

To install, run:

` $ pip install hibp `

## To run

You can query breach data on individual accounts/domains as well as data on full breaches. Each service request object contains a response attribute that holds the raw data output in JSON format. To perform a query, just setup a service request object, and then execute:

`python >> req = HIBP.get_account_breaches("pegasos1") >> req.execute() >> req.response `

If you want to query on multiple accounts or domains at once, you can use the AsyncHIBP object, which performs queries concurrently via gevent.

`python >> names = ['adobe','ashleymadison', 'myspace'] >> breaches = [HIBP.get_breach(x) for x in names] >> async_reqs = AsyncHIBP().map(breaches) >> [async_req.response for async_req in async_reqs] `

In addition to a canonical map method, AsyncHIBP also supports the imap method, which returns a generator object for lazy queries.

`python >> domains = ['','', ''] >> breaches = [HIBP.get_domain_breaches(x) for x in domains] >> async_reqs = AsyncHIBP().imap(breaches) >> next(async_reqs) `

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hibp, version 0.0.5
Filename, size & hash File type Python version Upload date
hibp-0.0.5-py2.py3-none-any.whl (8.5 kB) View hashes Wheel py2.py3
hibp-0.0.5.tar.gz (5.3 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page