Walmart Notes, Skuid script, etc
This commit is contained in:
@ -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 = {
|
||||
|
||||
24
Scripts/API_Tests/medialib_csv.py
Normal file
24
Scripts/API_Tests/medialib_csv.py
Normal 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)
|
||||
2
Scripts/API_Tests/spsmedia.csv
Normal file
2
Scripts/API_Tests/spsmedia.csv
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user