-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
27 lines (25 loc) · 924 Bytes
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
from delete_pkg import delete_pkg_api
def install_package(url , access_code , file_install_hash , unfile_hash) :
path = "rest/v11_8/Administration/packages/" + file_install_hash + "/install/"
payload = {}
headers = {
'OAuth-Token': access_code
}
url_path = url + '/' + path
try:
response = requests.request("GET", url_path, headers=headers, data = payload)
print(response)
except:
response = requests.request("GET", url_path, headers=headers, data = payload)
print(response)
if response.status_code == 200 :
print("Success ,Package has been installed")
return response.status_code
else :
print("Error in Installing the package")
print("Status Code :", response.status_code)
print("Reason :", response.json())
print("Deleting the Package")
delete_pkg_api( url ,access_code ,unfile_hash)
return None