<commit_before>#!/usr/bin/python3

import requests
import pprint
import argparse

parser = argparse.ArgumentParser(description='A tool to check if your email account has been in a breach By <NAME>')
parser.add_argument('-e', '--email-account', help='Email account to lookup', required=True)
args = parser.parse_args()

headers = {'User-agent': 'Have I been pwn module'}
API = 'https://haveibeenpwned.com/api/v2/breachedaccount/{0}'.format(args.email_account)
request = requests.get(API, headers=headers)

if request.status_code == 404:
    print('Cannot find your account')
else:
    entries = request.json()
    for entry in entries:
        print('Domain:', entry['Domain'])
        print('DateAdded:', entry['AddedDate'])
        print('BreachDate:', entry['BreachDate'])
        pprint.pprint(entry['Description'])
        print('IsSensitive:', entry['IsSensitive'])
        print('IsVerified:', entry['IsVerified'])
        print('PwnCount:', entry['PwnCount'])<commit_msg>Update to the v3 api<commit_after>#!/usr/bin/python3

import requests
import pprint
import argparse

parser = argparse.ArgumentParser(description='A tool to check if your email account has been in a breach By <NAME>')
parser.add_argument('-e', '--email-account', help='Email account to lookup', required=True)
parser.add_argument('-k', '--api-key', help='Your HIBP API key', required=True)
args = parser.parse_args()

headers = {'User-agent': 'Have I been pwn module',
           f'hibp-api-key': {args.api_key}}
API = f'https://haveibeenpwned.com/api/v3/breachedaccount/{args.email_account}'
request = requests.get(API, headers=headers)

if request.status_code == 404:
    print('Cannot find your account')
else:
    entries = request.json()
    for entry in entries:
        print('Domain:', entry['Domain'])
        print('DateAdded:', entry['AddedDate'])
        print('BreachDate:', entry['BreachDate'])
        pprint.pprint(entry['Description'])
        print('IsSensitive:', entry['IsSensitive'])
        print('IsVerified:', entry['IsVerified'])
        print('PwnCount:', entry['PwnCount'])
{'fraction_non_alphanumeric': 0.15784408084696824, 'fraction_numerical': 0.005774783445620789, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5409715', 'n_tokens_mistral': 647, 'n_tokens_neox': 638, 'n_words': 154}