Zapier scripts for AIIM that need to go into Workato
This commit is contained in:
19
Scripts/AIIM/shopify_groups_step4.py
Normal file
19
Scripts/AIIM/shopify_groups_step4.py
Normal file
@ -0,0 +1,19 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
headers = {"Accept": "application/json", "X-Api-Key": "2SBAjkYGUoD0LqesDZq50RSex"}
|
||||
def check_if_user_exists(searched_email, page_number):
|
||||
url = "https://api.northpass.com/v2/people?page="+str(page_number)+"&limit=100"
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
users_dict = json.loads(response.text)
|
||||
for person in users_dict["data"]:
|
||||
if person["attributes"]["email"] == searched_email:
|
||||
return {"founded": True, "userid": person["id"]}
|
||||
if len(users_dict["data"]) > 0 :
|
||||
return check_if_user_exists(searched_email, page_number+1)
|
||||
else:
|
||||
return {"founded": False, "userid": None}
|
||||
|
||||
email = input_data["email"]
|
||||
return check_if_user_exists(email, 1)
|
||||
|
||||
Reference in New Issue
Block a user