Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Coding Assessment
- Branden Youssef
- Enter an email address, get list of websites + where the user has possibly compromised accounts
- Using http://docs.python-requests.org/en/latest/ and https://docs.python.org/3/library/urllib.parse.html
- Python 3 code:
- import sys, requests, urllib
- print("__name__ value: ", __name__)
- def main():
- email = sys.stdin.readline()
- """ the url encoding below could alternatively be implemented
- with a for loop and if else statements when encountering any
- of the 8 characters that need to be encoded """
- req = requests.get('https://haveibeenpwned.com/api/v2/breachedaccount/' + urllib.parse.urlencode(email) )
- sys.stdout.write(req.headers['Domain'] )
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement