Some completed tasks. Script for large Walmart enrollment (which brought down the app... oops).

This commit is contained in:
Norm Rasmussen
2025-04-29 15:47:51 -04:00
parent 603e7baf6a
commit 00d628a532
4 changed files with 78 additions and 16 deletions

View File

@ -13,27 +13,33 @@ HEADERS = {
}
def get_people():
count = 0
count = 1
while True:
ppl_uuids = []
url = f"{BASEURL}/people?page={count}&limit=100"
print(url)
count += 1
response = requests.get(url, headers=HEADERS).json()
nextlink = response["links"]
for data in response['data']:
person_uuid = data['id']
if person_uuid == "c09c6319-7569-46ac-94d5-3885d9de4c2f" or person_uuid == "477de2a1-15cc-4d67-9e95-7e3910dca5d3":
print("Found Claudia or Fabian")
print(person_uuid)
print(data['attributes']['full_name'])
ppl_uuids.append(person_uuid)
if len(ppl_uuids) == 10:
print(len(ppl_uuids))
if len(ppl_uuids) == 100:
apply_prop(ppl_uuids)
# break
if "next" not in nextlink:
break
def apply_prop(ppl_uuids):
inserted_load = []
for person in ppl_uuids:
print(person)
miniload = {
"attributes": { "properties": { "new_content": "true" } },
"attributes": { "properties": { "new_content": "True" } },
"id": person,
"type": "person_properties"
}
@ -41,7 +47,16 @@ def apply_prop(ppl_uuids):
prop_url = f"{BASEURL}/properties/people/bulk"
payload = { "data": inserted_load }
print(payload)
# apply_payload = requests.posts(prop_url, json=payload, headers=HEADERS)
apply_payload = requests.post(prop_url, json=payload, headers=HEADERS)
stat = apply_payload.status_code
print(stat)
if "4" in str(stat):
print("....!")
print("Error! Error!")
print(stat.text)
print(payload)
print("....!")
if __name__ == "__main__":
get_people()