Update so script takes an argument from the command line.
This commit is contained in:
parent
1c6ab981b2
commit
b9b1a3bd84
|
@ -2,10 +2,14 @@
|
|||
import hashlib
|
||||
import requests
|
||||
|
||||
# allow script to receive an argument
|
||||
import sys
|
||||
email_input = sys.argv[1]
|
||||
|
||||
def hash_email(email):
|
||||
return hashlib.sha256(email.encode('utf-8')).hexdigest()
|
||||
|
||||
def fetch_gravatar(email="", size=1000, rating="g"):
|
||||
def fetch_gravatar(email, size=1000, rating="g"):
|
||||
url = f"https://www.gravatar.com/avatar/{hash_email(email)}?s={size}&r={rating}"
|
||||
print(url)
|
||||
response = requests.get(url)
|
||||
|
@ -34,4 +38,4 @@ def variety_of_sizes(email,sizes=[1000,1500,800,300,200,150,100]):
|
|||
|
||||
if __name__ == '__main__':
|
||||
# print( hash_email(email))
|
||||
variety_of_sizes("")
|
||||
variety_of_sizes(email_input)
|
||||
|
|
Loading…
Reference in New Issue
Block a user