2023-05-17 12:30:27 -04:00
|
|
|
import requests
|
|
|
|
|
import Apikeys
|
|
|
|
|
|
2023-07-27 22:20:47 -04:00
|
|
|
apiKey = Apikeys.bigideas
|
2023-05-17 12:30:27 -04:00
|
|
|
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"]:
|
2023-07-31 17:10:06 -04:00
|
|
|
created_at = response["attributes"]["created_at"]
|
|
|
|
|
if created_at.startswith("2023"):
|
|
|
|
|
group_id = response["id"]
|
|
|
|
|
group_name = response["attributes"]["name"]
|
|
|
|
|
# print(group_name)
|
|
|
|
|
groups_dict = {
|
|
|
|
|
"id": group_id,
|
|
|
|
|
"name": group_name,
|
|
|
|
|
"created_at": created_at,
|
|
|
|
|
}
|
|
|
|
|
groups.append(groups_dict)
|
2023-05-17 12:30:27 -04:00
|
|
|
|
|
|
|
|
if "next" not in nextlink:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
print(groups)
|
2023-07-27 22:20:47 -04:00
|
|
|
print(len(groups))
|
2023-05-17 12:30:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
get_groups(apiKey)
|