Walmart Notes, Skuid script, etc

This commit is contained in:
Norm Rasmussen
2022-12-07 14:10:10 -05:00
parent c5dad714d9
commit 5742d0401c
13 changed files with 614 additions and 398 deletions

View File

@ -1,6 +1,7 @@
import requests
apiKey = "SlpQlju219WnWogn94dQUT6Yt"
# apiKey = "SlpQlju219WnWogn94dQUT6Yt"
apiKey = "VNDXh8K4tLYJ-Nvp78bo6w"
url = "https://api.northpass.com/v1/media"
# function = sys.argv[1]
@ -25,8 +26,9 @@ def putTest(apiKey, url):
def getTest(apiKey, url):
headers = {"accept": "application/json", "X-Api-Key": apiKey}
response = requests.get(url, headers=headers)
print(response.text)
# print(response.text)
jsonResponse = response.json()
# print(jsonResponse["data"][1]["attributes"])
def postTest(apiKey, url):
headers = {

View File

@ -0,0 +1,24 @@
import requests
import pandas as pd
apiKey = "VNDXh8K4tLYJ-Nvp78bo6w"
url = "https://api.northpass.com/v1/media"
def getMedia(apiKey, url):
headers = {"accept": "application/json", "X-Api-Key": apiKey}
response = requests.get(url, headers=headers)
json = response.json()
print(json)
toCsv(json)
def toCsv(json):
js = pd.json_normalize(json, "links", "data", ["type", "attributes", ["asset_type"]])
# js = pd.read_json(json, orient="index")
print(js)
js.to_csv("/Users/normrasmussen/Documents/Northpass/Scripts/API_Tests/spsmedia.csv")
if __name__ == "__main__":
getMedia(apiKey, url)

File diff suppressed because one or more lines are too long