Updated a few scripts, mostly of Talkspace. Added some notes for big ideas. Began on Blacklane's signup page.

This commit is contained in:
Norm Rasmussen
2023-11-16 21:41:51 -05:00
parent aeb811db4e
commit c3aedce0d1
6 changed files with 143 additions and 12 deletions

View File

@ -18,3 +18,4 @@ ZENJOB = "LIXqtHXEqcXHyN0EtezngnpzA"
DATASNIPPER = "098Odf9CIkk4aQA1lW7tsa9k8"
CHUBB = "m6ZEBesXzpWx2vmp11rEHxrMY"
BIRCHSTREET = "WpMV3jF4q9Om5FjUsrzZifduE"
G2 = "JRDpCGQ7vSRiva6t5OkWDr5eJ"

View File

@ -4,8 +4,8 @@ from pathlib import Path
import Apikeys
import os
basefile = "/Users/normrasmussen/Downloads/Mizuno_Completions.csv"
api_key = Apikeys.mizuno
basefile = "/Users/normrasmussen/Downloads/TS1099-coursecompletions.csv"
api_key = Apikeys.TALKSPACE_1099
uuid_url = "https://api.northpass.com/v2/people?filter[email][eq]="
prop_url = "https://api.northpass.com/v2/properties/people/"
headers = {
@ -24,9 +24,9 @@ def load_file(basefile):
if os.path.isfile(basefile):
print(f"File found! Importing {basefile}")
for email in completions.itertuples():
row_num = email[0]
row_num = email[1]
row_dict = {"row_num": row_num}
email = email[3]
email = email[4]
url = uuid_url + f"{email}"
response = requests.get(url, headers=headers)
if response.status_code == 200:
@ -35,23 +35,22 @@ def load_file(basefile):
url2 = prop_url + f"{uuid}"
response = requests.get(url2, headers=headers)
data = response.json()
pgaid = (data["data"]
["attributes"]["properties"]["account_number"])
row_dict["pgaid"] = pgaid
userid = data["data"]["attributes"]["properties"]["user_id"]
row_dict["userid"] = userid
dict_list.append(row_dict)
print("No errors! Passing along the dictionary!")
except KeyError as e:
print(e)
print(f"{e} and the rest")
finally:
for info in dict_list:
row = info["row_num"]
pid = info["pgaid"]
completions.loc[completions.index[row], "PGA ID"] = pid
completions = completions[completions["PGA ID"] != "0"]
pid = info["userid"]
completions.loc[completions.index[row], "userid"] = pid
completions = completions[completions["userid"] != "0"]
# completions = completions.iloc[:, 0:]
print(completions)
completions.to_csv(
"/Users/normrasmussen/Downloads/Mizuno-10.23-Completions_with_PGAIDs.csv",
"/Users/normrasmussen/Downloads/Talkspace1099-Completions-All-IDS.csv",
index=False,
)