Finished/refactored the add-to-csv script for Talkspace to move faster and not make so many API calls. Added some notes for Datasnipper.

This commit is contained in:
Norm Rasmussen
2023-12-12 17:22:13 -05:00
parent b35a650a11
commit b8dd4f0fe6
7 changed files with 25116 additions and 1 deletions

View File

@ -24,11 +24,12 @@ def load_file(basefile):
if os.path.isfile(basefile):
print(f"File found! Importing {basefile}")
for email in completions.itertuples():
row_num = email[1]
row_num = email[0]
row_dict = {"row_num": row_num}
email = email[3]
url = uuid_url + f"{email}"
response = requests.get(url, headers=headers)
print(response)
if response.status_code == 200:
response = response.json()
uuid = response["data"][0]["id"]
@ -38,6 +39,7 @@ def load_file(basefile):
userid = data["data"]["attributes"]["properties"]["user_id"]
row_dict["userid"] = userid
dict_list.append(row_dict)
print(dict_list)
print("No errors! Passing along the dictionary!")
except KeyError as e:
print(f"{e} and the rest")