SJ api calls folder. Added a script for DeepL.

This commit is contained in:
Norm Rasmussen
2025-04-25 19:08:43 -04:00
parent c6d75b4284
commit 603e7baf6a
7 changed files with 190 additions and 12 deletions

View File

@ -0,0 +1,47 @@
import requests
import Apikeys
import pprint
pp=pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.DEEPL
BASEURL = "https://api.northpass.com/v2"
HEADERS = {
"accept": "application/json",
"X-Api-Key": APIKEY
}
def get_people():
count = 0
while True:
ppl_uuids = []
url = f"{BASEURL}/people?page={count}&limit=100"
print(url)
count += 1
response = requests.get(url, headers=HEADERS).json()
for data in response['data']:
person_uuid = data['id']
ppl_uuids.append(person_uuid)
if len(ppl_uuids) == 10:
print(len(ppl_uuids))
apply_prop(ppl_uuids)
# break
def apply_prop(ppl_uuids):
inserted_load = []
for person in ppl_uuids:
print(person)
miniload = {
"attributes": { "properties": { "new_content": "true" } },
"id": person,
"type": "person_properties"
}
inserted_load.append(miniload)
prop_url = f"{BASEURL}/properties/people/bulk"
payload = { "data": inserted_load }
print(payload)
# apply_payload = requests.posts(prop_url, json=payload, headers=HEADERS)
if __name__ == "__main__":
get_people()