daily pastebin goal
52%
SHARE
TWEET

Code

byoussef Feb 23rd, 2019 (edited) 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Coding Assessment
  2. Branden Youssef
  3.  
  4. Enter an email address, get list of websites + where the user has possibly compromised accounts
  5. Using http://docs.python-requests.org/en/latest/ and https://docs.python.org/3/library/urllib.parse.html
  6. Python 3 code:
  7.  
  8.  
  9. import sys, requests, urllib
  10. print("__name__ value: ", __name__)
  11. def main():
  12.     email = sys.stdin.readline()
  13.     """ the url encoding below could alternatively be implemented
  14.     with a for loop and if else statements when encountering any
  15.     of the 8 characters that need to be encoded """
  16.     req = requests.get('https://haveibeenpwned.com/api/v2/breachedaccount/' + urllib.parse.urlencode(email) )
  17.     sys.stdout.write(req.headers['Domain'] )
  18.  
  19. if __name__ == '__main__':
  20.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top