Skip to content
A Python client for the HaveIBeenPwned REST API
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pypwned Add support for HIBP API key and API v3. Fix for Issue #9. Sep 27, 2019
.gitignore Travis/PyPi support added? Feb 5, 2015
.travis.yml
AUTHORS.rst Initial Commit Feb 3, 2015
CHANGES.rst Initial Commit Feb 3, 2015
LICENSE.rst Initial Commit Feb 3, 2015
MANIFEST.in MANIFEST.in change Feb 5, 2015
README.md Add support for HIBP API key and API v3. Fix for Issue #9. Sep 27, 2019
requirements.txt
setup.py Add support for HIBP API key and API v3. Fix for Issue #9. Sep 27, 2019

README.md

PyPwned

Build Status

A Python client for the HaveIBeenPwned REST API. https://haveibeenpwned.com/

Installation

pip install pypwned

Requires

  • requests
  • pyOpenSSL
  • ndg-httpsclient
  • pyasn1

Usage

Note: The below examples assume you have loaded the envrionment variable HIBP_API_KEY with your appropriate Have I Been Pwned API key. More details here, https://haveibeenpwned.com/API/Key.

Breaches

Getting all breaches for an account

Get all breaches for an account across all domains.
import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getAllBreachesForAccount(email="foo@bar.com")
Get all breaches for an account across a specific domain.
import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getAllBreachesForAccount(email="foo@bar.com",domain="adobe.com")

Getting all breached sites in the system

Return the details of each breach in the system.
import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getAllBreaches()
Return the details of each breach associated with a specific domain.
import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getAllBreaches(domain="adobe.com")

Getting a single breached site

Return the details of a single breach, by breach name.

import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getSingleBreachedSite(name="adobe")

Getting all data classes in the system

Return the different types of data classes that are associated with a record in a breach. E.G, Email addresses and passwords

import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getAllDataClasses()

Pastes

Getting all pastes for an account

Return any pastes that contain the given email address

import pypwned, os
your_hibp_key = os.environ.get("HIBP_API_KEY")
pwny = pypwned.pwned(your_hibp_key)
pwny.getAllPastesForAccount(account="foo@bar.com")
You can’t perform that action at this time.