Transferred anthology script into python list of dictionaries... took forever. Learned lots of Neovim commands. Cin7 notes.
This commit is contained in:
BIN
Scripts/.DS_Store
vendored
BIN
Scripts/.DS_Store
vendored
Binary file not shown.
@ -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)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user