This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# creating function to split header | |
def parse_headers(header_line): | |
return header_line.strip().split(',') | |
# function to replace missing values | |
def parse_values(data_line): | |
values = [] | |
for items in data_line.strip().split(','): | |
if items == '': # check if there is an empty string | |
values.append(0.0) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import hashlib | |
import sys | |
# Creating a function to request api data | |
def request_api_data(query_char): | |
url = 'https://api.pwnedpasswords.com/range/'+ query_char | |
res = requests.get(url) # Sending request to api | |
if res.status_code != 200: | |
raise RuntimeError(f'Error fetching:{res.status_code},check the api and try again') |