Updated WilliamsSonoma post-new hire templates. Made good progress on migration tool scripts.
This commit is contained in:
36
Scripts/Migration_tool/Calls.py
Normal file
36
Scripts/Migration_tool/Calls.py
Normal file
@ -0,0 +1,36 @@
|
||||
import requests
|
||||
import Apikeys
|
||||
import pprint
|
||||
|
||||
|
||||
PP = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.SANDBOX
|
||||
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
|
||||
BASEURL = "https://api.northpass.com/v2"
|
||||
|
||||
|
||||
def get(url):
|
||||
try:
|
||||
get_response = requests.get(url, headers=HEADERS)
|
||||
# print(f"Executed Get Request. Status code is {get_response.status_code}")
|
||||
except HTTPError as h:
|
||||
print(
|
||||
f"Error occurred. Here's the info: {h} and status code: {get_response.status_code}"
|
||||
)
|
||||
finally:
|
||||
json_get = get_response.json()
|
||||
# PP.pprint(json_get)
|
||||
return json_get
|
||||
|
||||
|
||||
def post(url, payload):
|
||||
try:
|
||||
post_response = requests.get(url, headers=HEADERS, json=payload)
|
||||
print(f"Executed Post Request. Status code is {get_response.status_code}")
|
||||
except HTTPError as h:
|
||||
print(
|
||||
f"Error occurred. Here's the info: {h} and status code: {get_response.status_code}"
|
||||
)
|
||||
finally:
|
||||
json_post = get_response.json()
|
||||
# PP.pprint(json_post)
|
||||
BIN
Scripts/Migration_tool/__pycache__/Calls.cpython-310.pyc
Normal file
BIN
Scripts/Migration_tool/__pycache__/Calls.cpython-310.pyc
Normal file
Binary file not shown.
@ -122,8 +122,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -136,16 +135,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -199,9 +196,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -324,8 +319,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -338,16 +332,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -464,9 +456,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -566,8 +556,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -580,16 +569,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -643,9 +630,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -741,8 +726,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -755,16 +739,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -818,9 +800,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -852,8 +832,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -913,9 +892,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -968,8 +945,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1023,9 +999,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1088,8 +1062,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1127,8 +1100,7 @@
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1154,8 +1126,7 @@
|
||||
"description": "unprocessable entity",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1181,9 +1152,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1222,8 +1191,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1261,8 +1229,7 @@
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1288,9 +1255,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1303,9 +1268,7 @@
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
|
||||
],
|
||||
"produces": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "project_id",
|
||||
@ -1327,8 +1290,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"cache-control": {
|
||||
@ -1337,16 +1299,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1372,9 +1332,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1501,8 +1459,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1515,16 +1472,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1656,9 +1611,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1754,8 +1707,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1768,16 +1720,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1820,9 +1770,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1837,9 +1785,7 @@
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
|
||||
],
|
||||
"produces": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "project_id",
|
||||
@ -1892,8 +1838,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"cache-control": {
|
||||
@ -1902,17 +1847,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1951,8 +1893,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -1999,9 +1940,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2019,16 +1958,13 @@
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2092,9 +2028,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -2140,8 +2074,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2184,9 +2117,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2218,8 +2149,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2262,9 +2192,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -2277,9 +2205,7 @@
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
|
||||
],
|
||||
"produces": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "project_id",
|
||||
@ -2294,8 +2220,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"cache-control": {
|
||||
@ -2304,17 +2229,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -2367,8 +2289,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2411,9 +2332,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2516,8 +2435,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2530,16 +2448,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2626,9 +2542,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2688,8 +2602,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2731,8 +2644,7 @@
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2758,9 +2670,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2856,8 +2766,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2870,16 +2779,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "invalid params",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -2933,9 +2840,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -2967,8 +2872,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3003,8 +2907,7 @@
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3030,9 +2933,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -3110,8 +3011,7 @@
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3137,9 +3037,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -3152,9 +3050,7 @@
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
|
||||
],
|
||||
"produces": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "project_id",
|
||||
@ -3169,8 +3065,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"cache-control": {
|
||||
@ -3179,16 +3074,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3214,9 +3107,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -3294,8 +3185,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3330,8 +3220,7 @@
|
||||
"description": "not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3357,9 +3246,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3391,8 +3278,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3433,9 +3319,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3467,8 +3351,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3509,9 +3392,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3543,8 +3424,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3585,9 +3465,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3619,8 +3497,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3661,9 +3538,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3695,8 +3570,7 @@
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3709,16 +3583,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"204": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"cache-control": {
|
||||
@ -3727,16 +3599,14 @@
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"application/json": {
|
||||
}
|
||||
"application/json": {}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "failed operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3762,8 +3632,7 @@
|
||||
"description": "failed operation",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
}
|
||||
"properties": {}
|
||||
},
|
||||
"headers": {
|
||||
"content-type": {
|
||||
@ -3789,9 +3658,7 @@
|
||||
"deprecated": false,
|
||||
"security": [
|
||||
{
|
||||
"X-Api-Key": [
|
||||
|
||||
]
|
||||
"X-Api-Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
import requests
|
||||
import Apikeys
|
||||
import pprint
|
||||
|
||||
PP = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.SANDBOX
|
||||
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
|
||||
BASEURL = "https://api.northpass.com/v2/migration"
|
||||
|
||||
def create_project():
|
||||
"""
|
||||
Function to create a project with just a name. While ID is in the example payload, it isn't needed.
|
||||
Will generate a project ID for you in the return that you can use to transfer everything.
|
||||
Note that it will not give you an error if a project already exists with that name!
|
||||
"""
|
||||
payload = { "data": {
|
||||
"type": "migration_projects",
|
||||
"attributes": {
|
||||
"name": "My Second Migration Project"
|
||||
},
|
||||
} }
|
||||
create_req = requests.post(f"{BASEURL}/projects", headers=HEADERS, json=payload)
|
||||
print(payload)
|
||||
print(create_req.status_code)
|
||||
print(create_req.text)
|
||||
|
||||
|
||||
def get_all_projects():
|
||||
"""
|
||||
Returns all projects. Leverage PrettyPrint or uncomment the name to just return names and ids.
|
||||
"""
|
||||
get_proj = requests.get(f"{BASEURL}/projects", headers=HEADERS)
|
||||
print(get_proj.status_code)
|
||||
# PP.pprint(get_proj.json())
|
||||
|
||||
for items in get_proj.json()['data']:
|
||||
print(f"{ items['attributes']['name'] } -- { items['id'] }")
|
||||
|
||||
def get_specific_project():
|
||||
"""
|
||||
Returns results from a specific project.
|
||||
"""
|
||||
proj_id = "13aa7aed-3fb5-4488-9185-3befd0c1ae86"
|
||||
get_spec_proj = requests.get(f"{BASEURL}/projects/{proj_id}", headers=HEADERS)
|
||||
print(get_spec_proj.status_code)
|
||||
PP.pprint(get_spec_proj.json())
|
||||
|
||||
if __name__ == "__main__":
|
||||
# create_project()
|
||||
# get_all_projects()
|
||||
get_specific_project()
|
||||
101
Scripts/Migration_tool/mark_learner_as_complete.py
Normal file
101
Scripts/Migration_tool/mark_learner_as_complete.py
Normal file
@ -0,0 +1,101 @@
|
||||
import Calls
|
||||
|
||||
baseurl = Calls.BASEURL
|
||||
|
||||
|
||||
def get_people():
|
||||
email = "norm@rsmsn.co"
|
||||
if type(email) is str:
|
||||
learner_uuid = __get_individual_person__(email)
|
||||
get_courses(learner_uuid)
|
||||
elif type(email) is list:
|
||||
person_uuids = __get_group_person__(email)
|
||||
else:
|
||||
print("Couldn't recognize the type of data you're trying to use.")
|
||||
|
||||
|
||||
def get_courses(learner_uuid):
|
||||
course = "Norm Manager Test"
|
||||
if type(course) is str:
|
||||
course_uuids = __get_individual_course__(course, learner_uuid)
|
||||
elif type(course) is list:
|
||||
courses_uuids = __get_group_course__(course, learner_uuid)
|
||||
else:
|
||||
print("Couldn't recognize the type of data you're trying to use.")
|
||||
|
||||
|
||||
def __get_individual_course__(name, learner_uuid):
|
||||
url = f"{baseurl}/courses?filter[name][eq]={name}"
|
||||
returned = Calls.get(url)
|
||||
|
||||
for items in returned["data"]:
|
||||
single_uuid = items["id"]
|
||||
print(f"Cool. Course {single_uuid} exists. Checking enrollments.")
|
||||
enrollment = __get_enrollment_status__(single_uuid, learner_uuid)
|
||||
|
||||
def __get_enrollment_status__(uuid, learner_uuid):
|
||||
enrollment_url = f"{baseurl}/courses/{uuid}/enrollments?filter[person_id][eq]={learner_uuid}"
|
||||
enrolled = Calls.get(enrollment_url)
|
||||
if enrolled['data'] == "":
|
||||
print("Oof, no enrollments. Not to worry. We'll get one created for you.")
|
||||
"""
|
||||
If the learner isn't enrolled yet, we need to create one first. Here's the URL:
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/enrollment_resources",
|
||||
"post",
|
||||
)
|
||||
"""
|
||||
else:
|
||||
print("Nice! We have an enrollment. So now we just need to update progress.")
|
||||
"""
|
||||
If the learner is enrolled, we can go straight to creating an attempt.
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/course_attempt_resources",
|
||||
"post",
|
||||
)"""
|
||||
|
||||
|
||||
def __get_group_course__(list):
|
||||
multiple_uuids = []
|
||||
for person in email:
|
||||
url = f"{baseurl}/people?filter[email][eq]={email}"
|
||||
returned = Calls.get(url)
|
||||
|
||||
for items in returned["data"]:
|
||||
multiple_uuids.append(learner_uuid)
|
||||
|
||||
|
||||
def __get_individual_person__(email):
|
||||
url = f"{baseurl}/people?filter[email][eq]={email}"
|
||||
returned = Calls.get(url)
|
||||
|
||||
for items in returned["data"]:
|
||||
if items["attributes"]["registration_status"] == "activated":
|
||||
single_uuid = items["id"]
|
||||
print(
|
||||
f"Awesome. This dude is activated. Proceeding with learner {single_uuid}"
|
||||
)
|
||||
return single_uuid
|
||||
else:
|
||||
print("Sorry bruv, but ya mate ain't activated yet. Can't do nuffin.")
|
||||
|
||||
|
||||
def __get_group_person__(list):
|
||||
multiple_uuids = []
|
||||
for person in email:
|
||||
url = f"{baseurl}/people?filter[email][eq]={email}"
|
||||
returned = Calls.get(url)
|
||||
|
||||
for items in returned["data"]:
|
||||
if items["attributes"]["registration_status"] == "activated":
|
||||
print("Awesome. This dude is activated. Proceeding.")
|
||||
single_uuid = items["id"]
|
||||
multiple_uuids.append(learner_uuid)
|
||||
else:
|
||||
print("Sorry bruv, but ya mate ain't activated yet. Can't do nuffin.")
|
||||
return multiple_uuids
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_people()
|
||||
# get_courses()
|
||||
146
Scripts/Migration_tool/migration_playground.py
Normal file
146
Scripts/Migration_tool/migration_playground.py
Normal file
@ -0,0 +1,146 @@
|
||||
"""
|
||||
This file serves as the basecamp for all the calls for the projects.
|
||||
The Creation and Deletion functions will likely be put into different files after some time.
|
||||
For now, each function needs to be selected below.
|
||||
|
||||
*********
|
||||
Questions:
|
||||
- Does creating an attempt also create an enrollment?
|
||||
- Does an attempt/enrollment create a course?
|
||||
- No to either of these.
|
||||
- What is the point of multiple item_ids? They seem as variable as projects.
|
||||
- What is a display name in enrollment or attempt resources?
|
||||
|
||||
Notes:
|
||||
- If client delivers just course progress, do we call completed activities in the array 1, 2, and 3.
|
||||
- 427 within completed activities shows id, 281 within completed activities shows UUID.
|
||||
"""
|
||||
|
||||
import json
|
||||
import Calls
|
||||
|
||||
JSONDOC = "./api_docs.json"
|
||||
BASEURL = "https://api.northpass.com/v2/migration"
|
||||
|
||||
# All possible URLs and their functions:
|
||||
tupee = [
|
||||
# *************************
|
||||
# The most fundamental of calls.
|
||||
# *************************
|
||||
("/v2/migration/projects", "get", "post"),
|
||||
("/v2/migration/projects/{project_id}", "get", "delete", "patch"),
|
||||
("/v2/migration/projects/{project_id}/items", "get", "post"),
|
||||
("/v2/migration/projects/{project_id}/items/{item_id}", "get", "delete"),
|
||||
# *************************
|
||||
# Get Resources (Done after you've added them from below)
|
||||
# *************************
|
||||
("/v2/migration/projects/{project_id}/items/{item_id}/resources", "get"),
|
||||
|
||||
# *************************
|
||||
# Post calls for creating new resources.
|
||||
# *************************
|
||||
("/v2/migration/projects/{project_id}/items/{item_id}/section_resources", "post"),
|
||||
("/v2/migration/projects/{project_id}/items/{item_id}/person_resources", "post"),
|
||||
("/v2/migration/projects/{project_id}/items/{item_id}/process_resources", "post"),
|
||||
("/v2/migration/projects/{project_id}/items/{item_id}/course_resources", "post"),
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/quiz_attempt_resources",
|
||||
"post",
|
||||
),
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/activity_resources",
|
||||
"post",
|
||||
),
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/course_attempt_resources",
|
||||
"post",
|
||||
),
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/enrollment_resources",
|
||||
"post",
|
||||
),
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/items/{item_id}/learning_path_attempt_resources",
|
||||
"post",
|
||||
),
|
||||
# *************************
|
||||
# This is just for setting up the Skilljar Config. Not needed yeet.
|
||||
# *************************
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/skilljar_configuration",
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch",
|
||||
),
|
||||
# *************************
|
||||
# Extract is just for getting things out of Skilljar
|
||||
# *************************
|
||||
("/v2/migration/projects/{project_id}/extraction_processes", "get"),
|
||||
("/v2/migration/projects/{project_id}/extract_course_attempts", "post"),
|
||||
("/v2/migration/projects/{project_id}/extract_courses", "post"),
|
||||
("/v2/migration/projects/{project_id}/extract_enrollments", "post"),
|
||||
("/v2/migration/projects/{project_id}/extract_people", "post"),
|
||||
(
|
||||
"/v2/migration/projects/{project_id}/extraction_processes/{extraction_process_id}/processing_logs",
|
||||
"get",
|
||||
),
|
||||
# *************************
|
||||
# Migrate is putting things into CE.
|
||||
# *************************
|
||||
("/v2/migration/projects/{project_id}/start_migration", "post"),
|
||||
]
|
||||
|
||||
|
||||
def read_json_docs():
|
||||
file = open(JSONDOC)
|
||||
data = json.load(file)
|
||||
for items, vals in data["paths"].items():
|
||||
print(items)
|
||||
for cmds in vals:
|
||||
print(cmds)
|
||||
file.close()
|
||||
|
||||
|
||||
def create_project():
|
||||
"""
|
||||
Function to create a project with just a name. While ID is in the example payload, it isn't needed.
|
||||
Will generate a project ID for you in the return that you can use to transfer everything.
|
||||
Note that it will not give you an error if a project already exists with that name!
|
||||
"""
|
||||
project_name = ""
|
||||
payload = {
|
||||
"data": {
|
||||
"type": "migration_projects",
|
||||
"attributes": {"name": project_name},
|
||||
}
|
||||
}
|
||||
url = f"{BASEURL}/projects"
|
||||
Calls.post(url, payload)
|
||||
|
||||
|
||||
def get_all_projects():
|
||||
"""
|
||||
Returns all projects.
|
||||
"""
|
||||
url = f"{BASEURL}/projects"
|
||||
ret = Calls.get(url)
|
||||
|
||||
for items in ret["data"]:
|
||||
print(f"{ items['attributes']['name'] } -- { items['id'] }")
|
||||
|
||||
|
||||
def get_specific_project():
|
||||
"""
|
||||
Returns results from a specific project.
|
||||
"""
|
||||
proj_id = "13aa7aed-3fb5-4488-9185-3befd0c1ae86"
|
||||
url = f"{BASEURL}/projects/{proj_id}"
|
||||
Calls.get(url)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# read_json_docs()
|
||||
# create_project()
|
||||
get_all_projects()
|
||||
# get_specific_project()
|
||||
Reference in New Issue
Block a user