Skip to content

Commit cdef33b

Browse files
author
Kyle
committed
Final
1 parent a71696a commit cdef33b

File tree

9 files changed

+39
-27
lines changed

9 files changed

+39
-27
lines changed
0 Bytes
Binary file not shown.
362 Bytes
Binary file not shown.
Binary file not shown.

backend/database.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,5 @@ def delete_rows():
225225
"version": "2.29.0"
226226
}
227227
if __name__ == "__main__":
228-
print(get_all_users())
228+
print(get_names_with_tags("petr"))
229229

backend/db.db

8 KB
Binary file not shown.
87 Bytes
Binary file not shown.
Binary file not shown.

backend/endpoints/get.py

+7-22
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,13 @@
55
import requests
66

77

8-
#url = "https://globalemail.melissadata.net/v4/WEB/GlobalEmail/doGlobalEmail"
9-
10-
11-
12-
# # Make a GET request using the requests library
13-
# response = requests.get(url, params=params)
14-
15-
# def check_email(email):
16-
# params = {
17-
# 'id': "gxEnKiQsOnDEki3tgvSky_**nSAcwXpxhQ0PC2lXxuDAZ-**",
18-
# 'opt': "VerifyMailBox:Premium,DomainCorrection:off,WhoIs:on",
19-
# 'format': "json",
20-
# 'email': f"{email}"
21-
# }
22-
# response = requests.get(url, params=params)
23-
# if response.status_code == 200:
24-
# result = response.json()
25-
# result_dict = json.loads(result)
26-
# score = int(result_dict["Records"]["DeliverabilityConfidenceScore"])
27-
# return score > 30
28-
# else:
29-
# return False
8+
url = "https://globalemail.melissadata.net/v4/WEB/GlobalEmail/doGlobalEmail"
9+
10+
11+
12+
# Make a GET request using the requests library
13+
14+
3015

3116
@app.get("/schools/")
3217
def get_schools():

backend/endpoints/post.py

+31-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22
import json
33
from components import userLogin, newUser, pageData, newBio, newTags, tagsSearch
44
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
5+
import requests
6+
7+
url = "https://globalemail.melissadata.net/v4/WEB/GlobalEmail/doGlobalEmail"
8+
9+
10+
def check_email(email):
11+
params = {
12+
'id': "gxEnKiQsOnDEki3tgvSky_**nSAcwXpxhQ0PC2lXxuDAZ-**",
13+
'opt': "VerifyMailBox:Premium,DomainCorrection:off,WhoIs:on",
14+
'format': "json",
15+
'email': f"{email}"
16+
}
17+
response = requests.get(url, params=params)
18+
if response.status_code == 200:
19+
result_dict = response.json()
20+
print(result_dict)
21+
score = int(result_dict["Records"][0]["DeliverabilityConfidenceScore"])
22+
return score > 20
23+
else:
24+
return False
25+
526

627

728

@@ -31,10 +52,13 @@ async def post_search_results(search_tags: tagsSearch):
3152
results = ','.join(list(results))
3253
json_result = json.dumps({"username": results})
3354
return {json_result}
55+
3456
@app.post("/get_all_users/")
3557
async def post_all_users():
3658
results = get_all_users()
37-
return {results}
59+
results = ','.join(list(results))
60+
json_result = json.dumps({"username": results})
61+
return {json_result}
3862

3963

4064

@@ -47,9 +71,12 @@ async def post_create_user(user_info: newUser):
4771
elif not user_info.school_email.__contains__(domain_result[0][0]):
4872
return {1}
4973
else:
50-
add_new_users(user_info.username, user_info.password, user_info.email, user_info.school_email, user_info.school_id)
51-
set_new_page_with_user(user_info.username, user_info.school_id)
52-
return {2}
74+
if check_email(user_info.school_email):
75+
add_new_users(user_info.username, user_info.password, user_info.email, user_info.school_email, user_info.school_id)
76+
set_new_page_with_user(user_info.username, user_info.school_id)
77+
return {2}
78+
else:
79+
return {1}
5380

5481
# turn it from json to dict
5582
# verify that username is avail

0 commit comments

Comments
 (0)