DV,Walmart, API Tests
This commit is contained in:
44
Scripts/API_Tests/api_test.py
Normal file
44
Scripts/API_Tests/api_test.py
Normal file
@ -0,0 +1,44 @@
|
||||
import requests
|
||||
|
||||
apiKey = "SlpQlju219WnWogn94dQUT6Yt"
|
||||
url = "https://api.northpass.com/v1/media"
|
||||
#function = sys.argv[1]
|
||||
|
||||
def putTest(apiKey, url):
|
||||
|
||||
payload = {
|
||||
"data":
|
||||
{
|
||||
"type":"media",
|
||||
"file_name":"/Users/normrasmussen/Downloads/Shopping&Delivery 9 XP.mp4",
|
||||
}
|
||||
}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apiKey,
|
||||
}
|
||||
response = requests.put(url, json=payload, headers=headers)
|
||||
print(response.text)
|
||||
|
||||
def getTest(apiKey,url):
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.get(url, headers=headers)
|
||||
print(response.text)
|
||||
|
||||
def postTest(apiKey, url):
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.post(url, headers=headers)
|
||||
print(response.text)
|
||||
|
||||
if __name__ == "__main__":
|
||||
getTest(apiKey, url)
|
||||
#putTest(apiKey, url)
|
||||
#postTest(apiKey, url)
|
||||
Reference in New Issue
Block a user