Transferred anthology script into python list of dictionaries... took forever. Learned lots of Neovim commands. Cin7 notes.

This commit is contained in:
Norm Rasmussen
2023-11-07 16:57:58 -05:00
parent 346f57c589
commit 089c3fb385
8 changed files with 17917 additions and 46 deletions

View File

@ -1,18 +1,21 @@
import pprint
import json
import requests
import Apikeys
apiKey = Apikeys.bigideas
APIKEY = Apikeys.ANTHOLOGY
groups_dict = {}
pp = pprint.PrettyPrinter(indent=4)
def get_groups(apiKey):
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}
headers = {"accept": "application/json", "X-Api-Key": APIKEY}
response = requests.get(url, headers=headers)
data = response.json()
nextlink = data["links"]
@ -33,9 +36,11 @@ def get_groups(apiKey):
if "next" not in nextlink:
break
print(groups)
print(len(groups))
pp.pprint(groups)
# print(len(groups))
with open('/Users/normrasmussen/Documents/Work/CustomerNotes/Anthology/antho-groups.json', 'w') as jsn:
json.dump(groups, jsn)
if __name__ == "__main__":
get_groups(apiKey)
get_groups(APIKEY)