Updated Mizuno's templates for the sign up page, and added a new template for Walmart. New script for Zenjob to remove a bunch of people from an internal testing group.
This commit is contained in:
39
Scripts/API_Tests/get_ppl_in_group_and_remove.py
Normal file
39
Scripts/API_Tests/get_ppl_in_group_and_remove.py
Normal file
@ -0,0 +1,39 @@
|
||||
import requests
|
||||
import Apikeys
|
||||
|
||||
BASEURL = "https://api.northpass.com/v2/"
|
||||
APIKEY = Apikeys.ZENJOB
|
||||
GROUPUUID = "940a5d24-32af-45f1-8ed4-8a6b4689d9c9"
|
||||
HEADERS = {"accept": "application/json", "X-Api-Key": APIKEY}
|
||||
|
||||
|
||||
def get_ppl_without_email_in_group():
|
||||
count = 0
|
||||
url = f"groups/{GROUPUUID}/memberships"
|
||||
filter = "?filter[name][not_cont]=zenjob.com"
|
||||
while True:
|
||||
count += 1
|
||||
request_url = f"{BASEURL}{url}{filter}&page={count}"
|
||||
response = requests.get(request_url, headers=HEADERS)
|
||||
response = response.json()
|
||||
next = response["links"]
|
||||
|
||||
for ids in response["data"]:
|
||||
person_uuid = ids["relationships"]["person"]["data"]["id"]
|
||||
remove_from_group(person_uuid)
|
||||
|
||||
if "next" not in next:
|
||||
break
|
||||
|
||||
|
||||
def remove_from_group(person_uuid):
|
||||
url = f"people/{person_uuid}/relationships/groups"
|
||||
request_url = f"{BASEURL}{url}"
|
||||
payload = {"data": [{"id": GROUPUUID, "type": "membership-groups"}]}
|
||||
response = requests.delete(request_url, json=payload, headers=HEADERS)
|
||||
code = response.status_code
|
||||
print(f"For person {person_uuid}, the returned code was {code}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_ppl_without_email_in_group()
|
||||
Reference in New Issue
Block a user