Files
Gainsight/Scripts/API_Tests/api_test.py

47 lines
1.2 KiB
Python
Raw Normal View History

2022-11-03 21:06:46 -04:00
import requests
2022-12-07 14:10:10 -05:00
# apiKey = "SlpQlju219WnWogn94dQUT6Yt"
apiKey = "VNDXh8K4tLYJ-Nvp78bo6w"
2022-11-03 21:06:46 -04:00
url = "https://api.northpass.com/v1/media"
# function = sys.argv[1]
2022-11-30 17:19:16 -05:00
2022-11-03 21:06:46 -04:00
def putTest(apiKey, url):
2022-11-30 17:19:16 -05:00
2022-11-03 21:06:46 -04:00
payload = {
"data": {
"type": "media",
"file_name": "/Users/normrasmussen/Downloads/Shopping&Delivery 9 XP.mp4",
}
}
2022-11-03 21:06:46 -04:00
headers = {
"accept": "application/json",
"content-type": "application/json",
"X-Api-Key": apiKey,
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
2022-11-30 17:19:16 -05:00
def getTest(apiKey, url):
headers = {"accept": "application/json", "X-Api-Key": apiKey}
2022-11-03 21:06:46 -04:00
response = requests.get(url, headers=headers)
2022-12-07 14:10:10 -05:00
# print(response.text)
jsonResponse = response.json()
# print(jsonResponse["data"][1]["attributes"])
2022-11-30 17:19:16 -05:00
2022-11-03 21:06:46 -04:00
def postTest(apiKey, url):
headers = {
2022-11-30 17:19:16 -05:00
"accept": "application/json",
"content-type": "application/json",
"X-Api-Key": apiKey,
2022-11-03 21:06:46 -04:00
}
response = requests.post(url, headers=headers)
print(response.text)
2022-11-30 17:19:16 -05:00
2022-11-03 21:06:46 -04:00
if __name__ == "__main__":
getTest(apiKey, url)
2022-11-30 17:19:16 -05:00
# putTest(apiKey, url)
# postTest(apiKey, url):