Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle committed Jan 28, 2024
1 parent a71696a commit cdef33b
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 27 deletions.
Binary file modified backend/__pycache__/api.cpython-311.pyc
Binary file not shown.
Binary file modified backend/__pycache__/database.cpython-311.pyc
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,5 @@ def delete_rows():
"version": "2.29.0"
}
if __name__ == "__main__":
print(get_all_users())
print(get_names_with_tags("petr"))

Binary file modified backend/db.db
Binary file not shown.
Binary file modified backend/endpoints/__pycache__/get.cpython-311.pyc
Binary file not shown.
Binary file modified backend/endpoints/__pycache__/post.cpython-311.pyc
Binary file not shown.
29 changes: 7 additions & 22 deletions backend/endpoints/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,13 @@
import requests


#url = "https://globalemail.melissadata.net/v4/WEB/GlobalEmail/doGlobalEmail"



# # Make a GET request using the requests library
# response = requests.get(url, params=params)

# def check_email(email):
# params = {
# 'id': "gxEnKiQsOnDEki3tgvSky_**nSAcwXpxhQ0PC2lXxuDAZ-**",
# 'opt': "VerifyMailBox:Premium,DomainCorrection:off,WhoIs:on",
# 'format': "json",
# 'email': f"{email}"
# }
# response = requests.get(url, params=params)
# if response.status_code == 200:
# result = response.json()
# result_dict = json.loads(result)
# score = int(result_dict["Records"]["DeliverabilityConfidenceScore"])
# return score > 30
# else:
# return False
url = "https://globalemail.melissadata.net/v4/WEB/GlobalEmail/doGlobalEmail"



# Make a GET request using the requests library



@app.get("/schools/")
def get_schools():
Expand Down
35 changes: 31 additions & 4 deletions backend/endpoints/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
import json
from components import userLogin, newUser, pageData, newBio, newTags, tagsSearch
from database import get_user, get_email_domain, get_password_from_user, add_new_users, add_page_with_user, set_new_page_with_user, update_bio, update_tags, get_names_with_tags, get_all_users
import requests

url = "https://globalemail.melissadata.net/v4/WEB/GlobalEmail/doGlobalEmail"


def check_email(email):
params = {
'id': "gxEnKiQsOnDEki3tgvSky_**nSAcwXpxhQ0PC2lXxuDAZ-**",
'opt': "VerifyMailBox:Premium,DomainCorrection:off,WhoIs:on",
'format': "json",
'email': f"{email}"
}
response = requests.get(url, params=params)
if response.status_code == 200:
result_dict = response.json()
print(result_dict)
score = int(result_dict["Records"][0]["DeliverabilityConfidenceScore"])
return score > 20
else:
return False




Expand Down Expand Up @@ -31,10 +52,13 @@ async def post_search_results(search_tags: tagsSearch):
results = ','.join(list(results))
json_result = json.dumps({"username": results})
return {json_result}

@app.post("/get_all_users/")
async def post_all_users():
results = get_all_users()
return {results}
results = ','.join(list(results))
json_result = json.dumps({"username": results})
return {json_result}



Expand All @@ -47,9 +71,12 @@ async def post_create_user(user_info: newUser):
elif not user_info.school_email.__contains__(domain_result[0][0]):
return {1}
else:
add_new_users(user_info.username, user_info.password, user_info.email, user_info.school_email, user_info.school_id)
set_new_page_with_user(user_info.username, user_info.school_id)
return {2}
if check_email(user_info.school_email):
add_new_users(user_info.username, user_info.password, user_info.email, user_info.school_email, user_info.school_id)
set_new_page_with_user(user_info.username, user_info.school_id)
return {2}
else:
return {1}

# turn it from json to dict
# verify that username is avail
Expand Down

0 comments on commit cdef33b

Please sign in to comment.