Added some scripts for Doximity. Changed Zenjob's templates
This commit is contained in:
37
Scripts/API_Tests/get-group-ids.py
Normal file
37
Scripts/API_Tests/get-group-ids.py
Normal file
@ -0,0 +1,37 @@
|
||||
import requests
|
||||
import Apikeys
|
||||
|
||||
apiKey = Apikeys.doximity_internal
|
||||
groups_dict = {}
|
||||
|
||||
|
||||
def get_groups(apiKey):
|
||||
count = 0
|
||||
groups = []
|
||||
|
||||
while True:
|
||||
count += 1
|
||||
url = f"https://api.northpass.com/v2/groups?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": apiKey}
|
||||
response = requests.get(url, headers=headers)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
|
||||
for response in data["data"]:
|
||||
group_id = response["id"]
|
||||
group_name = response["attributes"]["name"]
|
||||
print(group_name)
|
||||
groups_dict = {
|
||||
"id": group_id,
|
||||
"name": group_name,
|
||||
}
|
||||
groups.append(groups_dict)
|
||||
|
||||
if "next" not in nextlink:
|
||||
break
|
||||
|
||||
print(groups)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_groups(apiKey)
|
||||
Reference in New Issue
Block a user